npm.io
1.2.2 • Published 9 years ago

extract-package

Licence
MIT
Version
1.2.2
Deps
5
Vulns
1
Weekly
0

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)