(path: string, expectedSha256: string)
| 139 | } |
| 140 | |
| 141 | function verifyArchive(path: string, expectedSha256: string): void { |
| 142 | const actualSha256 = createHash('sha256').update(readFileSync(path)).digest('hex'); |
| 143 | if (actualSha256 !== expectedSha256) { |
| 144 | throw new Error(`fd archive checksum mismatch: ${actualSha256} !== ${expectedSha256}`); |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | async function downloadFile(url: string, dest: string): Promise<void> { |
| 149 | const response = await fetch(url, { signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS) }); |