(candidatePath)
| 350 | } |
| 351 | |
| 352 | function fileSha256(candidatePath) { |
| 353 | const digest = crypto.createHash('sha256'); |
| 354 | const fd = fs.openSync(candidatePath, 'r'); |
| 355 | const buffer = Buffer.allocUnsafe(64 * 1024); |
| 356 | try { |
| 357 | for (;;) { |
| 358 | const count = fs.readSync(fd, buffer, 0, buffer.length, null); |
| 359 | if (count === 0) break; |
| 360 | digest.update(buffer.subarray(0, count)); |
| 361 | } |
| 362 | } finally { |
| 363 | fs.closeSync(fd); |
| 364 | } |
| 365 | return digest.digest('hex'); |
| 366 | } |
| 367 | |
| 368 | function filesEqualSha256(leftPath, rightPath) { |
| 369 | try { |
no test coverage detected