download
Download and extract files
Last updated 9 years ago by kevva .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install download 
SYNC missed versions from official npm registry.

download Build Status

Download and extract files

See download-cli for the command-line version.

Install

$ npm install download

Usage

const fs = require('fs');
const download = require('download');

(async () => {
	await download('http://unicorn.com/foo.jpg', 'dist');

	fs.writeFileSync('dist/foo.jpg', await download('http://unicorn.com/foo.jpg'));

	download('unicorn.com/foo.jpg').pipe(fs.createWriteStream('dist/foo.jpg'));

	await Promise.all([
		'unicorn.com/foo.jpg',
		'cats.com/dancing.gif'
	].map(url => download(url, 'dist')));
})();

Proxies

To work with proxies, read the got documentation.

API

download(url, destination?, options?)

Returns both a Promise<Buffer> and a Duplex stream with additional events.

url

Type: string

URL to download.

destination

Type: string

Path to where your file will be written.

options

Type: Object

Same options as got and decompress in addition to the ones below.

extract

Type: boolean
Default: false

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

filename

Type: string

Name of the saved file.

Current Tags

  • 8.0.0                                ...           latest (5 years ago)
  • 4.0.1-rc.1                                ...           rc (10 years ago)

70 Versions

  • 8.0.0                                ...           5 years ago
  • 7.1.0                                ...           6 years ago
  • 7.0.0                                ...           7 years ago
  • 6.2.5                                ...           7 years ago
  • 6.2.4                                ...           7 years ago
  • 6.2.3                                ...           8 years ago
  • 6.2.2                                ...           8 years ago
  • 6.2.1                                ...           8 years ago
  • 6.2.0                                ...           8 years ago
  • 6.1.0                                ...           8 years ago
  • 6.0.0                                ...           8 years ago
  • 5.0.3                                ...           8 years ago
  • 5.0.2                                ...           9 years ago
  • 5.0.1                                ...           9 years ago
  • 5.0.0                                ...           9 years ago
  • 4.4.3                                ...           9 years ago
  • 4.4.2                                ...           9 years ago
  • 4.4.1                                ...           9 years ago
  • 4.3.0                                ...           9 years ago
  • 4.2.1                                ...           9 years ago
  • 4.2.0                                ...           9 years ago
  • 4.1.4                                ...           9 years ago
  • 4.1.3                                ...           9 years ago
  • 4.1.2                                ...           10 years ago
  • 4.1.1                                ...           10 years ago
  • 4.1.0                                ...           10 years ago
  • 4.0.1                                ...           10 years ago
  • 4.0.0                                ...           10 years ago
  • 4.0.1-rc.1                                ...           10 years ago
  • 3.3.0                                ...           10 years ago
  • 3.2.0                                ...           10 years ago
  • 3.1.2                                ...           10 years ago
  • 3.1.1                                ...           10 years ago
  • 3.1.0                                ...           10 years ago
  • 3.0.1                                ...           10 years ago
  • 3.0.0                                ...           10 years ago
  • 2.0.0                                ...           10 years ago
  • 1.0.7                                ...           10 years ago
  • 1.0.6                                ...           10 years ago
  • 1.0.5                                ...           10 years ago
  • 1.0.4                                ...           10 years ago
  • 1.0.3                                ...           10 years ago
  • 0.1.19                                ...           10 years ago
  • 1.0.2                                ...           10 years ago
  • 1.0.1                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
  • 0.2.4                                ...           10 years ago
  • 0.2.3                                ...           10 years ago
  • 0.2.2                                ...           10 years ago
  • 0.2.1                                ...           10 years ago
  • 0.2.0                                ...           10 years ago
  • 0.1.18                                ...           10 years ago
  • 0.1.17                                ...           11 years ago
  • 0.1.16                                ...           11 years ago
  • 0.1.15                                ...           11 years ago
  • 0.1.14                                ...           11 years ago
  • 0.1.13                                ...           11 years ago
  • 0.1.12                                ...           11 years ago
  • 0.1.11                                ...           11 years ago
  • 0.1.10                                ...           11 years ago
  • 0.1.9                                ...           11 years ago
  • 0.1.8                                ...           11 years ago
  • 0.1.7                                ...           11 years ago
  • 0.1.6                                ...           11 years ago
  • 0.1.5                                ...           11 years ago
  • 0.1.4                                ...           11 years ago
  • 0.1.3                                ...           11 years ago
  • 0.1.2                                ...           11 years ago
  • 0.1.1                                ...           11 years ago
  • 0.1.0                                ...           11 years ago
Downloads
Total 22
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (7)
Dev Dependencies (7)

© 2010 - cnpmjs.org x YWFE | Home | YWFE