(targetDirPath: string, binary: BinaryFileData)
| 61 | } |
| 62 | |
| 63 | export async function downloadBinaryFile(targetDirPath: string, binary: BinaryFileData): Promise<string> { |
| 64 | const targetFile = join(targetDirPath, binary.targetFile); |
| 65 | await downloadFile(binary.url, targetFile); |
| 66 | const actualHash = calculateFileHash(targetFile); |
| 67 | if (actualHash !== binary.sha256) { |
| 68 | throw new Error(`Expected hash ${binary.sha256}, but actual hash value is ${actualHash}`); |
| 69 | } |
| 70 | |
| 71 | return targetFile; |
| 72 | } |
no test coverage detected