Skip to content

springuper/promise-concurrency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

promise-concurrency

Build Status

run promises in parallel with a concurrency limit.

Installation

npm install promise-concurrency

Example

The most common use case:

const promiseConcurrency = require('promise-concurrency')

var promiseFactories = [5, 4, 3, 2, 1].map(function (item) {
    return function () {
        return new Promise(function (resolve, reject) {
            setTimeout(function () {
                resolve(item);
            }, item * 100);
        });
    };
});
promiseConcurrency(promiseFactories, 2).then(function (value) {
    console.log(value); // => [5, 4, 3, 2, 1]
});

About

run promises in parallel with concurrency limit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published