download-package

0.2.0 • Public • Published

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 running downloadPkg
  • The browserify package files will be stored in ./packages/browserify
  • The downloaded browserify package can be 'required' like any other package: require('./packages/browserify')

Package Sidebar

Install

npm i download-package

Weekly Downloads

5

Version

0.2.0

License

ISC

Last publish

Collaborators

  • ttmarek