forEachAsync
The async counterpart to Array.prototype.forEach: runs fn for every item for its
side effects, discarding any return value. Prefer mapAsync when you need the
results — this only exists to signal that intent clearly, same as the sync
forEach/map pair.
Available since v3.0.4
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
array | readonly T[] | The array to iterate |
fn | function | Async (or sync) function called with `(item, index)` |
concurrency | number | Maximum number of concurrent calls. Defaults to unlimited. (optional) |
Returns
Section titled “Returns”Promise<void> — A promise that resolves once every call has settled
Examples
Section titled “Examples”Upload files with a concurrency cap
Section titled “Upload files with a concurrency cap”Runs fn for its side effects only; at most concurrency calls at once.
