2.0.0 • Published 3 years ago

@rodrigogs/promise-pool v2.0.0

Weekly downloads
29
License
bsd-3-clause
Repository
github
Last release
3 years ago

promise-pool

This promise pool keeps looping Promise.all's promises until the last generator item is submitted to the processor.

Install

$ npm install @rodrigogs/promise-pool

Usage

const promisePool = require('@rodrigogs/promise-pool');
 
function* generatorFunction(start, end) { // Could be an async generator
  for (let i = start; i <= end; i += 1) {
    yield i;
  }
}

function processor(generatorValue) { // Could be an async function
  console.log(generatorValue);
}

(async () => {
  await promisePool({
    generator: generatorFunction(100, 1000),
    processor,
    concurrency: 10,
  });
})();

License

BSD-3-Clause © Rodrigo Gomes da Silva

2.0.0

3 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago