download-package
v0.2.0
Published
Download a package from the npm registry into any folder
Downloads
29
Readme
download-package
Download the latest version of an npm package to a specified directory
Installation
npm install --save download-package
Example use
Here's how you would install the latest version of browserify
into a packages
folder:
const downloadPkg = require('download-package')
downloadPkg('browserify', `${__dirname}/packages`)
.then(() => console.log('do other stuff'))
.catch(() => console.log('there was an error downloading the package'))
Notes for the above example:
- The destination folder (
./packages
) must exist before runningdownloadPkg
- The
browserify
package files will be stored in./packages/browserify
- The downloaded
browserify
package can be 'required' like any other package:require('./packages/browserify')