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

Function fileSha256

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

Source from the content-addressed store, hash-verified

212}
213
214function 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
230function filesEqualSha256(leftPath, rightPath) {
231 try {

Callers 3

filesEqualSha256Function · 0.85
pathMatchesDigestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected