(filePath: string, expectedMd5: string)
| 3 | import * as path from "path"; |
| 4 | |
| 5 | export 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 | } |
nothing calls this directly
no outgoing calls
no test coverage detected