1.0.5 • Published 6 years ago
promise-limiter v1.0.5
Promise Limiter
Like Promise.all, but limits the number of functions running simultaneously.
Example
const PromiseLimit = require('promise-limiter');
const results = await PromiseLimit([1, 2, 3, 4, 5], 2, async (val) => {
// Do some async stuff
return val * val;
});
console.log(results);
// [1, 4, 9, 16, 25]
The second parameter can also be an options obj:
PromiseLimit(arr, {
ignoreErrors: true,
limit: 3,
}, async () => {});