extract-package

Download and extract npm package version


Keywords
download, extract, npm, package, tarball
License
MIT
Install
npm install extract-package@1.2.2

Documentation

npm version

extract-package

Download and extract npm package version

Requires

Node 6+

Install

$ npm install extract-package

Usage

const extractPackage = require('extract-package')

extractPackage({
  name: 'lodash'
}).then(response => {
  // path where package is downloaded
  console.log(response)
}).catch(error => {
  // oops!
})

Specify a version

extractPackage({
  name: 'lodash',
  version: '1.0.0'
})

Specify where to drop the package

extractPackage({
  name: 'lodash',
  version: '1.0.0',
  dest: '/path/to/folder'
})

Satisfy major versions

Assuming that the package version are 1.4.5, 1.6.5 and 2.0.0, this example will download the version 1.6.5, which is the latest version that satisfies that major version.

extractPackage({
  name: 'lodash',
  version: '1'
}, true)