Registry / devops / npm-fetch

npm-fetch

JSON →
library0.0.9jsnpmunverified

Fetch npm module tarballs from various sources, including npm registry, GitHub, git, and local files. Current version 0.0.9 is marked as a work in progress and unstable. Provides high-level fetch() and per-source functions like npm.version(), npm.range(), github(), tarball(), local.dir(), local.file(). Differs from pacote or npm-packlist by focusing on tarball download rather than full package extraction.

npm install npm-fetch
INSTALL
IMPORT
SIG · NPM-FETCH
N
npm-fetch
devopsjavascriptv0.0.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default (fetch)
var fetch = require('npm-fetch')
import fetch from 'npm-fetch'
CJS-only; no ESM support.
npm.version, npm.range, npm.tag
var npm = require('npm-fetch').npm; npm.version(...)
require('npm-fetch/npm').version(...)
These are methods on the 'npm' object exported from the package.
github, tarball, local.dir, local.file
var github = require('npm-fetch').github; github(...)
require('npm-fetch/github')
All per-source functions are properties of the default export.

Downloads the tarball of npm-fetch version 0.0.1 to a local file.

var fetch = require('npm-fetch'); var dest = __dirname + '/npm-fetch.tgz'; fetch('npm-fetch@0.0.1', dest, function (err) { if (err) throw err; console.log('Tarball downloaded to ' + dest); })
Debug
Known issues
deprecatedPackage is marked as a work in progress and has not been updated since version 0.0.9 (2015). It is effectively deprecated.
fix
Use alternatives like pacote or npm-packlist for tarball fetching.
affects: >=0.0.0
gotchaThe high-level fetch() function expects (name, spec, dest, options, cb) with options before callback, but documentation order may be confusing.
fix
Always pass options object even if empty: fetch(name, spec, dest, {}, cb).
affects: >=0.0.0
gotchaThe github() function uses '#tag' syntax (e.g., 'user/repo#tag'), not semver ranges or URLs.
fix
Use fetch.github(name, 'user/repo#tag', options) with the sharp symbol.
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'npm-fetch'
Package is old and may not be installed; npm registry may have removed it.
fix
Check if package is still available: npm view npm-fetch. If missing, use pacote instead.
fetch.github is not a function
Using wrong import pattern; assume github is a separate module.
Upgrade
Version history
0.0.9latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
npm-fetch — npm install npm-fetch · libregistry