JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 457
  • Score
    100M100P100Q101093F

A flexible pool of promises that can be awaited and executed at a chosen level of concurrency

Package Exports

  • async-promise-pool

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (async-promise-pool) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm version CircleCI

Promise Pool

Promise pool is a small, dependency free, library to manage the concurrent resolution of any number of promises. It is particularly useful when the promises are not all available upfront.

Example Usage

const PromisePool = require("async-promise-pool");

// concurrency is the only option for PromisePool and enables you to 
// choose how many promises will run at once
const pool = new PromisePool({ concurrency: 3 });

// elsewhere add functions to the pool that produce promises. We use
// functions here to prevent the promises from immediately executing.
pool.add(() => thingThatReturnsAPromise());

// you can await pool.all to ensure that all promises in the pool are 
// resolved before continuing.
await pool.all();