promises-concurrency
1.0.1 • Public • Published promises-concurrency
This is a small library to limit concurrency of promises.
Installation
$ npm install promises-concurrency
How to use
const Concurrency = require('promises-concurrency');
const promiseWithValue = value => new Promise((resolve, reject) => {
setTimeout(function(){
resolve(value);
}, 1000);
});
const promises = [];
for (let i=0; i<10; i++){
promises.push(() => promiseWithValue(i));
}
Concurrency.all(promises, 3)
.then(results => {
});
Package Sidebar
Install
npm i promises-concurrency
Weekly Downloads