diff --git a/lib/install.js b/lib/install.js index 29d0bbe..6730f2a 100644 --- a/lib/install.js +++ b/lib/install.js @@ -59,7 +59,11 @@ async function downloadPrebuilt() { const tempPath = path.join(VENDOR_DIR, `_dl.${process.pid}.tgz`); try { await pipeline(Readable.fromWeb(response.body), fs.createWriteStream(tempPath)); - const tar = spawnSync('tar', ['-xzf', tempPath, '-C', VENDOR_DIR], {stdio: 'inherit'}); + // Pass tar a *relative* filename via cwd, not an absolute path. + // Windows' bsdtar treats `C:\...` as a `host:path` remote spec + // ("Cannot connect to C: resolve failed"); using a basename with + // cwd avoids that ambiguity and works identically on POSIX. + const tar = spawnSync('tar', ['-xzf', path.basename(tempPath)], {cwd: VENDOR_DIR, stdio: 'inherit'}); if (tar.status !== 0) { throw new Error(`tar extraction exited with status ${tar.status}`); } diff --git a/package.json b/package.json index b63defc..6fd3d43 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "optipng-bin", - "version": "9.2.0", + "version": "9.2.1", "description": "OptiPNG wrapper that makes it seamlessly available as a local dependency", "license": "MIT", "repository": "PruvoNet/optipng-bin",