MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / extract

Function extract

scripts/npm-shim.js:232–239  ·  view source on GitHub ↗
(archive, destDir)

Source from the content-addressed store, hash-verified

230// Extract via the system tar — present on macOS, Linux, and Windows 10+
231// (bsdtar reads .zip too). No third-party dependency in the shim.
232function extract(archive, destDir) {
233 var args = isWindows
234 ? ['-xf', archive, '-C', destDir, '--strip-components=1']
235 : ['-xzf', archive, '-C', destDir, '--strip-components=1'];
236 var res = childProcess.spawnSync('tar', args, { stdio: 'ignore', windowsHide: true });
237 if (res.error) throw new Error('tar unavailable: ' + res.error.message);
238 if (res.status !== 0) throw new Error('tar exited ' + res.status);
239}
240
241function rmrf(p) {
242 try { fs.rmSync(p, { recursive: true, force: true }); } catch (e) { /* best effort */ }

Callers 1

selfHealBundleFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected