npm-install-fetch (v1.3.14, last updated 2024) is a Node.js API and CLI tool for automatically fetching external resources during the npm install step. It helps keep npm package distribution sizes small by downloading large binary assets or archives on install instead of bundling them. Key differentiators: supports YAML config, platform/architecture filtering, decompression, archive extraction with path mapping, and multiple resources per package. Unlike other fetch-on-install tools, it integrates tightly with npm's lifecycle scripts and offers both CLI and package.json configuration.
npm install npm-install-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to add npm-install-fetch as a devDependency and configure it via the install script to fetch a tar.gz archive into example.tgz.
Use ESM imports: import { installFetch } from 'npm-install-fetch';Replace --decompress with --extract and adjust --strip/--filter as needed.
Add npm-install-fetch to devDependencies in package.json.
Use absolute paths or __dirname in the install script.
Run 'npm install --save-dev npm-install-fetch' to ensure it's in devDependencies.
Use import syntax or use dynamic import() inside your CJS script.
Check the URL, ensure network connectivity, and verify the output path is writable.