MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / downloadFile

Function downloadFile

apps/kimi-code/src/utils/process/fd-detect.ts:148–157  ·  view source on GitHub ↗
(url: string, dest: string)

Source from the content-addressed store, hash-verified

146}
147
148async 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
159function extractArchive(archivePath: string, extractDir: string, assetName: string): void {
160 if (assetName.endsWith('.tar.gz')) {

Callers 1

downloadFdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected