Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jamen/npm-dl-package
Download a package from npm's registry given a name with optional versioning/tags.
https://github.com/jamen/npm-dl-package
Last synced: 17 days ago
JSON representation
Download a package from npm's registry given a name with optional versioning/tags.
- Host: GitHub
- URL: https://github.com/jamen/npm-dl-package
- Owner: jamen
- License: mit
- Created: 2016-06-16T11:05:24.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-06-16T11:13:19.000Z (over 8 years ago)
- Last Synced: 2024-03-27T05:49:15.655Z (8 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# npm-dl-package
> Download a package from npm's registry given a name with optional versioning/tags.```javascript
var dl = require('npm-dl-package');
var write = require('fs').createWriteStream;dl('audio@~1.0.0', function(err, file, info) {
if (err) throw err;
file.pipe(write('./' info._id '.tgz'));
});
```## Installation
```shell
$ npm install --save npm-dl-package
```## API
### `dl(id, callback)`
Download a package off [npm's registry][npm-registry], with optional versioning/tags.- `id` (`String`): Package name to download, with optional version or tag. (i.e. `audio`, `audio@~1.0.0`, `audio@latest`)
- `callback` (`Function`): Callback function to handle results.### `callback(err, file, info)`
- `err` (`Error`|`null`): An error to handle, otherwise null.
- `file` (`Stream`): An `IncommingMessage` stream of the package file.
- `pkg` (`Object`): Extra information about the package.## Credits
| ![jamen][avatar] |
|:---:|
| [Jamen][github] |[avatar]: https://avatars.githubusercontent.com/u/6251703?v=3&s=125
[github]: https://github.com/jamen
[npm-registry]: https://docs.npmjs.com/misc/registry