(candidatePath)
| 212 | } |
| 213 | |
| 214 | function fileSha256(candidatePath) { |
| 215 | const digest = crypto.createHash('sha256'); |
| 216 | const fd = fs.openSync(candidatePath, 'r'); |
| 217 | const buffer = Buffer.allocUnsafe(64 * 1024); |
| 218 | try { |
| 219 | for (;;) { |
| 220 | const count = fs.readSync(fd, buffer, 0, buffer.length, null); |
| 221 | if (count === 0) break; |
| 222 | digest.update(buffer.subarray(0, count)); |
| 223 | } |
| 224 | } finally { |
| 225 | fs.closeSync(fd); |
| 226 | } |
| 227 | return digest.digest('hex'); |
| 228 | } |
| 229 | |
| 230 | function filesEqualSha256(leftPath, rightPath) { |
| 231 | try { |
no outgoing calls
no test coverage detected