New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

parallel-download

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parallel-download

Download files in parallel to the buffer

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

DEPRECATED

Use Promise.all or smart promise queues like p-queue instead. Please, let me known if you want to take this package name.

parallel-download

travis npm license downloads Code Climate Test Coverage bitHound Score bitHound Dependencies

Download files in parallel to the buffer

install

npm i parallel-download

features

  • work with super small http library simple-get
  • work with ES6
  • supports nodejs >=4
  • Promise instead of callbacks
  • extremely small size (< 100 lines of code)

usage

const pd = require('parallel-download');

pd(['http://example.com/one', 'http://example.com/two'])
	.then(res => {/* ... */})

API

  • pd(url [, opts])
param url (String|Array[String]|Object|Array[Object])

Url/config or array of urls/configs. Available options:

  • all options of simple-get
  • timeout - download timeout in ms, default 60s
  • retries - redownload on error, default 1
  • followErrors - don't catch errors. Attention! All pending requests will not aborted!
param opts (Object)

shared config, has a low priority

pd({url:"http://example.com/", timeout: 5e3}, {timeout:10e3})
	.then(/* ... */);
// timeout is 5e3
return res (Promise)

This promise always resolved. Promise contains an array of IncomingMessage instances with additional fields:

  • url (string) - original request url (for identify each request)
  • content (Buffer) - ungzipped (if need) response (or you can use res.pipe)

Resolved array contain fields:

  • error (Array[Error])

Each error object contain fields:

  • all standart fields
  • url (string) - original request url (for identify each request)
  • response (IncomingMessage) - original server response

Breaking changes between 0.3 and 1.0

  • 100% rewrited
  • removed queue mode and maxSize, tryTimeout, stream options.

License

MIT, 2015 (c) Dmitry Tsvettsikh

Keywords

parallel

FAQs

Package last updated on 14 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts