Download and extract files effortlessly in Node.js.
Install with npm: npm install download
If you're fetching an archive you can set extract: true
in options and
it'll extract it for you.
var download = require('download');
// download and extract `foo.tar.gz` into `bar/`
download('foo.tar.gz', 'bar', { extract: true; });
// download and save `foo.jpg` into `bar/foo.jpg`
download('foo.jpg', 'bar');
// download and save an array of files in `bar/`
var files = ['foo.jpg', 'bar.jpg', 'cat.jpg'];
download(files, 'bar');
Download a file or an array of files to a given destination.
-
extract
— If set totrue
, try extracting the file using decompress.
You can also define options accepted by the request module.