MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / fileSha256

Function fileSha256

pkg/npm/install.js:352–366  ·  view source on GitHub ↗
(candidatePath)

Source from the content-addressed store, hash-verified

350}
351
352function 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
368function filesEqualSha256(leftPath, rightPath) {
369 try {

Callers 4

filesEqualSha256Function · 0.85
pathMatchesDigestFunction · 0.85
verifyChecksumFunction · 0.85

Calls 1

updateMethod · 0.80

Tested by

no test coverage detected