| 2338 | } |
| 2339 | }, |
| 2340 | typeHash = function node_apps_hash_dirComplete_typeHash(index:number, end:number) { |
| 2341 | const terminate = function node_apps_hash_dirComplete_typeHash_terminate():void { |
| 2342 | c = c + 1; |
| 2343 | if (c === end) { |
| 2344 | if (a === listlen) { |
| 2345 | hashComplete(); |
| 2346 | } else { |
| 2347 | if (verbose === true) { |
| 2348 | console.log(`${apps.humantime(false)}${text.green + apps.commas(a) + text.none} files hashed so far...`); |
| 2349 | } |
| 2350 | c = 0; |
| 2351 | recurse(); |
| 2352 | } |
| 2353 | } |
| 2354 | }; |
| 2355 | if (list[index][1] === "directory" || list[index][1] === "link") { |
| 2356 | const hash:Hash = node.crypto.createHash("sha512"); |
| 2357 | hash.update(list[index][0]); |
| 2358 | if (hashlist === true) { |
| 2359 | listObject[list[index][0]] = hash.digest("hex"); |
| 2360 | } else { |
| 2361 | hashes[index] = hash.digest("hex"); |
| 2362 | } |
| 2363 | terminate(); |
| 2364 | } else { |
| 2365 | apps.readFile({ |
| 2366 | path: list[index][0], |
| 2367 | stat: list[index][4], |
| 2368 | index: index, |
| 2369 | callback: function node_apps_hash_dirComplete_typehash_callback(data:readFile, item:string|Buffer):void { |
| 2370 | hashback(data, item, function node_apps_hash_dirComplete_typeHash_callback(hashstring:string, item:number) { |
| 2371 | hashes[item[0]] = hashstring; |
| 2372 | if (hashlist === true) { |
| 2373 | listObject[data.path] = hashstring; |
| 2374 | } else { |
| 2375 | hashes[item[0]] = hashstring; |
| 2376 | } |
| 2377 | terminate(); |
| 2378 | }); |
| 2379 | } |
| 2380 | }); |
| 2381 | } |
| 2382 | }, |
| 2383 | recurse = function node_apps_hash_dirComplete_recurse():void { |
| 2384 | let b = 0, |
| 2385 | end = (listlen - a < shortlimit) |