| 146 | } |
| 147 | |
| 148 | async function downloadFile(url: string, dest: string): Promise<void> { |
| 149 | const response = await fetch(url, { signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS) }); |
| 150 | if (!response.ok) { |
| 151 | throw new Error(`Failed to download fd: ${response.status}`); |
| 152 | } |
| 153 | if (response.body === null) { |
| 154 | throw new Error('Failed to download fd: empty response body'); |
| 155 | } |
| 156 | await pipeline(Readable.fromWeb(response.body), createWriteStream(dest)); |
| 157 | } |
| 158 | |
| 159 | function extractArchive(archivePath: string, extractDir: string, assetName: string): void { |
| 160 | if (assetName.endsWith('.tar.gz')) { |