JSPM

npmdl

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q32223F
  • License MIT

Conveniently download files from npm packages

Package Exports

  • npmdl

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (npmdl) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npmdl

Conveniently download files from npm packages, caching the results on the file system.

You could use this to build your own npm-cdn, or a simple requirebin-type editor. Note however that because scripts aren't run that some packages might not work this way.

Usage

NPM

dl = npmdl([directory])

Creates a new downloader, using directory to store downloaded packages in. directory defaults to ~/.npmdl.

dl(package, version, filename, done)

Downloads package@version, and calls done(err, content) with the contents of filename when complete. If already downloaded, the file will be read out directly so we can save bandwidth and go a little easier on the npm registry :)

var npmdl = require('npmdl')

npmdl(__dirname)('browserify', '9.0.0', 'bin/advanced.txt', function(err, content) {
  if (err) throw err

  // logs browserify@9.0.0's advanced help to the console
  console.log(content)
})

License

MIT. See LICENSE.md for details.