download
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/download package

0.1.4 • Public • Published

download Build Status

Download and extract files effortlessly in Node.js.

Getting started

Install with npm: npm install download

Examples

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');

API

download(url, dest, opts)

Download a file or an array of files to a given destination.

Options

  • extract — If set to true, try extracting the file using decompress.

You can also define options accepted by the request module.

License

MIT License (c) Kevin Mårtensson

Package Sidebar

Install

npm i download@0.1.4

Version

0.1.4

License

MIT

Last publish

Collaborators

  • shinnn
  • kevva
  • silverwind