Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tommoor/promise-pool
A flexible pool of promises that can be awaited and executed at a chosen level of concurrency
https://github.com/tommoor/promise-pool
hacktoberfest javascript promise
Last synced: 3 months ago
JSON representation
A flexible pool of promises that can be awaited and executed at a chosen level of concurrency
- Host: GitHub
- URL: https://github.com/tommoor/promise-pool
- Owner: tommoor
- Created: 2018-04-15T19:07:14.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2022-12-07T10:50:49.000Z (about 2 years ago)
- Last Synced: 2024-04-13T07:31:18.254Z (10 months ago)
- Topics: hacktoberfest, javascript, promise
- Language: JavaScript
- Homepage:
- Size: 502 KB
- Stars: 10
- Watchers: 5
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![npm version](https://badge.fury.io/js/async-promise-pool.svg)](https://badge.fury.io/js/async-promise-pool) [![CircleCI](https://circleci.com/gh/tommoor/promise-pool.svg?style=svg)](https://circleci.com/gh/tommoor/promise-pool)
# 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
```javascript
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();
```