MCPcopy Create free account
hub / github.com/JasonShin/sqlx-ts / verifyHash

Function verifyHash

node/postinstall.js:117–130  ·  view source on GitHub ↗
(filePath, expectedHash)

Source from the content-addressed store, hash-verified

115}
116
117async function verifyHash(filePath, expectedHash) {
118 const actualHash = await calculateSHA256(filePath)
119
120 if (actualHash !== expectedHash) {
121 throw new Error(
122 `Hash mismatch!\n` +
123 `Expected: ${expectedHash}\n` +
124 `Got: ${actualHash}\n` +
125 `This could indicate a corrupted download or a security issue.`
126 )
127 }
128
129 return true
130}
131
132function extractBinary(zipPath, binaryName, targetPath) {
133 const zip = new AdmZip(zipPath)

Callers 1

installFunction · 0.85

Calls 1

calculateSHA256Function · 0.85

Tested by

no test coverage detected