
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
Run promise-returning & async functions concurrently with optional limited concurrency
Run promise-returning & async functions concurrently with optional limited concurrency
Similar to Promise.all(), but accepts functions instead of promises directly so you can limit the concurrency.
If you're doing the same work in each function, use p-map instead.
See p-series for a serial counterpart.
npm install p-all
import pAll from 'p-all';
import got from 'got';
const actions = [
() => got('https://sindresorhus.com'),
() => got('https://avajs.dev'),
() => checkSomething(),
() => doSomethingElse()
];
console.log(await pAll(actions, {concurrency: 2}));
Returns a Promise that is fulfilled when all promises returned from calling the functions in tasks are fulfilled, or rejects if any of the promises reject. The fulfilled value is an Array of the fulfilled values in tasks order.
Type: Iterable<Function>
Iterable with promise-returning/async functions.
Type: object
Type: number (Integer)
Default: Infinity
Minimum: 1
Number of concurrently pending promises.
Type: boolean
Default: true
When set to false, instead of stopping when a promise rejects, it will wait for all the promises to settle and then reject with an AggregateError containing all the errors from the rejected promises.
Type: AbortSignal
You can abort the promises using AbortController.
Bluebird is a comprehensive promise library with a wide range of features including concurrency control. It offers similar functionality through its 'Promise.map' method with a 'concurrency' option. Bluebird is known for its performance and additional utilities for promise manipulation.
The async library provides a collection of asynchronous utilities. Its 'parallelLimit' function can be used to achieve similar concurrency control as p-all. Async is not promise-based by default but supports promises and also provides other flow control utilities.
p-limit is a package that limits the number of concurrent promise executions, similar to p-all. The difference is that p-limit provides a lower-level API where you create a limiter function and then apply it to individual promises, whereas p-all takes an array of promise-returning functions.
p-queue is a promise queue with adjustable concurrency that can be paused, resumed, and cleared. It is more feature-rich than p-all, providing a queue interface with more control over the execution of tasks, including dynamic prioritization and task cancellation.
FAQs
Run promise-returning & async functions concurrently with optional limited concurrency
The npm package p-all receives a total of 942,199 weekly downloads. As such, p-all popularity was classified as popular.
We found that p-all demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.