5.0.0 • Published 11 months ago

p-all v5.0.0

Weekly downloads
1,341,335
License
MIT
Repository
github
Last release
11 months ago

p-all

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.

Install

npm install p-all

Usage

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}));

API

pAll(tasks, options?)

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.

tasks

Type: Iterable<Function>

Iterable with promise-returning/async functions.

options

Type: object

concurrency

Type: number\ Default: Infinity\ Minimum: 1

Number of concurrent pending promises.

stopOnError

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.

Related

  • p-map - Map over promises concurrently
  • p-series - Run promise-returning & async functions in series
  • p-props - Like Promise.all() but for Map and Object
  • p-queue - Promise queue with concurrency control
  • p-limit - Run multiple promise-returning & async functions with limited concurrency
  • More…
netease-sdksearch-reviews-by-keywordsnode-dingtalk-corp@piyushmishra/criticallumerin-wallet-corepg-api-server@open-containers-manager/cli@saaspe/componentsrenovate@everything-registry/sub-chunk-2396nsrace@anejs/mina-loaderbedrock-edv-storagebedrock-kmsbedrock-ledger-consensus-continuitybedrock-web-vc-storebedrock-web-walletbeginpm-template@abtnode/ux@abtnode/core@abtnode/cli@auto/core@auto/fs@auto/github@auto/start-plugin@baethon/udba-bootstrap@darkobits/nr@cythral/renovate@bitdiver/runner-server@blkmarketco/components-library@blocklet/ui-react@bbc/timeline-state-resolverblue-pill@bara/basics@brickdoc/cpy@glaced/generator@bedrock/web-vc-store@bedrock/web-walletobs-uploadpkguporronihilpromise-funreact-form-component-libraryparvan_componentsparvan_reactjs_componentspadoraclep-funp-thunkp-promise-utilsoss-upload-clipayment-kitpivotal-to-zenhubsearch-keywordssequelcomponentsenadores-asistenciasenadores-viajesvdxtorrent-managerunified-vscodetsc-multitimeline-state-resolvershadowkeepersmart-uploadsvelte-component-libtailchat-cliroc-plugin-reporootnovatesindresorhus.jsremark-vscode@bedrock/edv-storage@bedrock/kmsrehype-lqiprenovate-csm@commonshost/edgecode-migrator@hypertorrent/manager@hypertorrent/torrent@dollarshaveclub/e2e@dollarshaveclub/monitor@did-space/client@did-space/core@did-space/s3-driver@ant-design/codemod-v5autemquod@arcblock/arcli@gdyfe/node-deployer@http2/edgedesign-system-fitbank-450dingtalk.js@emedvedev/renovate@ckatzorke/renovate@bufferapp/clippycos-upload-clicriticalcritical-log@gooddollar/bridge-app@goodgamestudios/cxf-plugins@jupiterone/cli@jupiterone/jupiter-policy-builder@jupiterone/jupiterone-client-nodejs
5.0.0

11 months ago

4.0.0

3 years ago

3.0.0

4 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.0.0

7 years ago