MCPcopy Create free account
hub / github.com/6174/comflowyspace / verifyFileMd5

Function verifyFileMd5

apps/node/src/modules/utils/verifymd5.ts:5–15  ·  view source on GitHub ↗
(filePath: string, expectedMd5: string)

Source from the content-addressed store, hash-verified

3import * as path from "path";
4
5export async function verifyFileMd5(filePath: string, expectedMd5: string): Promise<boolean> {
6 const fileBuffer: Buffer = fs.readFileSync(filePath);
7 const fileMd5: string = crypto.createHash('md5').update(fileBuffer).digest('hex');
8
9 if (fileMd5 !== expectedMd5) {
10 // throw new Error(`MD5 verification failed for ${path.basename(filePath)}`);
11 return false;
12 }
13 return true;
14 // logger.info(`MD5 verification successful for ${path.basename(filePath)}`);
15}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected