settle
Runs an array of promises concurrently and partitions the outcomes instead of
rejecting on the first failure, unlike Promise.all.
Built on top of Promise.allSettled, but returns fulfilled values and rejection
reasons already split apart so callers don’t need to inspect status themselves.
No concurrency limit, and none is possible here: promises are already-constructed
Promise objects, and a promise starts running the moment it’s created — by the time
settle receives the array, every promise in it is already in flight. There is
nothing left to throttle. If you need to cap how many run at once (e.g. many file
reads or requests), use parallelSettle instead, which takes functions
(() => Promise<T>) so it controls when each one starts.
Available since v3.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
promises | readonly Promise<T>[] | Promises to run concurrently |
Returns
Section titled “Returns”Promise<object> — An object with fulfilled values and rejected reasons, each in input order
Examples
Section titled “Examples”Partition fulfilled and rejected outcomes
Section titled “Partition fulfilled and rejected outcomes”Runs promises concurrently and splits results instead of rejecting on the first failure.
All promises succeed
Section titled “All promises succeed”Returns an empty rejected array when nothing fails.
