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

Function extractArchive

apps/kimi-code/src/utils/process/fd-detect.ts:159–173  ·  view source on GitHub ↗
(archivePath: string, extractDir: string, assetName: string)

Source from the content-addressed store, hash-verified

157}
158
159function extractArchive(archivePath: string, extractDir: string, assetName: string): void {
160 if (assetName.endsWith('.tar.gz')) {
161 runExtractionCommand('tar', ['xzf', archivePath, '-C', extractDir]);
162 return;
163 }
164 if (assetName.endsWith('.zip')) {
165 if (platform() === 'win32') {
166 runExtractionCommand(getWindowsTarCommand(), ['xf', archivePath, '-C', extractDir]);
167 return;
168 }
169 runExtractionCommand('unzip', ['-q', archivePath, '-d', extractDir]);
170 return;
171 }
172 throw new Error(`Unsupported fd archive format: ${assetName}`);
173}
174
175function runExtractionCommand(command: string, args: readonly string[]): void {
176 const result = spawnSync(command, [...args], { stdio: 'pipe' });

Callers 1

downloadFdFunction · 0.85

Calls 2

runExtractionCommandFunction · 0.85
getWindowsTarCommandFunction · 0.85

Tested by

no test coverage detected