download

WebJar for download

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

download
Last Version

Last Version

6.2.5
Release Date

Release Date

Type

Type

jar
Description

Description

download
WebJar for download
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/kevva/download

Download download

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/download/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>download</artifactId>
    <version>6.2.5</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/download/
implementation 'org.webjars.npm:download:6.2.5'
// https://jarcasting.com/artifacts/org.webjars.npm/download/
implementation ("org.webjars.npm:download:6.2.5")
'org.webjars.npm:download:jar:6.2.5'
<dependency org="org.webjars.npm" name="download" rev="6.2.5">
  <artifact name="download" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='download', version='6.2.5')
)
libraryDependencies += "org.webjars.npm" % "download" % "6.2.5"
[org.webjars.npm/download "6.2.5"]

Dependencies

compile (11)

Group / Artifact Type Version
org.webjars.npm : pify jar [3.0.0,4)
org.webjars.npm : content-disposition jar [0.5.2,0.6)
org.webjars.npm : decompress jar [4.0.0,5)
org.webjars.npm : get-stream jar [3.0.0,4)
org.webjars.npm : make-dir jar [1.0.0,2)
org.webjars.npm : ext-name jar [5.0.0,6)
org.webjars.npm : file-type jar 5.2.0
org.webjars.npm : got jar [7.0.0,8)
org.webjars.npm : filenamify jar [2.0.0,3)
org.webjars.npm » p-event jar [1.0.0,2)
org.webjars.npm : caw jar [2.0.0,3)

Project Modules

There are no modules declared in this project.

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.

Versions

Version
6.2.5
4.2.0