npm.io
1.0.0 • Published 10 years ago

promise-concurrent

Licence
MIT
Version
1.0.0
Deps
0
Vulns
0
Weekly
0
Stars
5

promise-concurrent Build Status

Execute a list of promises with a limited concurrency

Install

$ npm install --save promise-concurrent

Usage

const promiseConcurrent = require('promise-concurrent');
const got = require('got');

const endpoints = [
	got.bind(got, 'todomvc.com'),
	got.bind(got, 'yeoman.io'),
	got.bind(got, 'ava.li')
];

promiseConcurrent(endpoints, 1).then(result => {
	console.log(result);
	//=> array of response objects
});

API

promiseConcurrent(promises, [concurrency])
promises

Type: function[]

Array of functions that return a promise.

concurrency

Type: number
Default: 0

Number of concurrent executions. 0 means maximum concurrency.

License

MIT Sam Verschueren

Keywords