$ cnpm install download-tarball
Download a tarball (optionally gzipped) to a folder & extract it in the process. Uses the wonderful & super quick tar-fs & gunzip-maybe libraries.
Download node at nodejs.org and install it, if you haven't already.
npm install download-tarball --save
/* eslint-disable import/no-extraneous-dependencies */
import download from 'download-tarball';
download({
url: 'http://link-to-tarball/file.tar.gz',
dir: '/dir/where/file/will/be/downloaded'
}).then(() => {
console.log('file is now downloaded!');
}).catch(err => {
console.log('oh crap the file could not be downloaded properly');
console.log(err);
});
download({
url: 'http://link-to-tarball/file.tar.gz',
dir: '/dir/where/file/will/be/downloaded',
// custom options that will be forwarded to got.stream(..., opts) can also be set
gotOpts: {
headers: {
beep: 'boop'
}
}
}).then(() => {
console.log('file is now downloaded!');
}).catch(err => {
console.log('oh crap the file could not be downloaded properly');
console.log(err);
});
download({
// neat, tar files works as well!
url: 'http://link-to-tarball/file.tar',
dir: '/dir/where/file/will/be/downloaded'
}).then(() => {
console.log('file is now downloaded!');
}).catch(err => {
console.log('oh crap the file could not be downloaded properly');
console.log(err);
});
npm install
npm test
Object.assign() ponyfillMIT
Generated by package-json-to-readme
Copyright 2013 - present © cnpmjs.org | Home |