From 5b56ec8336a45915782ce3dedb9b09dafdfb34d8 Mon Sep 17 00:00:00 2001 From: Mustafa Senoglu Date: Fri, 25 Sep 2026 19:22:47 +0300 Subject: [PATCH] doc: clarify forEach concurrency and ordering Signed-off-by: Mustafa Senoglu --- doc/api/stream.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/api/stream.md b/doc/api/stream.md index 1e8a2bd1ef9..8f00571093b 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2326,6 +2326,11 @@ stopped by having passed a `signal` option and aborting the related `AbortController` while `for await...of` can be stopped with `break` or `return`. In either case the stream will be destroyed. +When `concurrency` is greater than `1`, `fn` may be invoked on multiple chunks +at once, but the calls are still awaited in chunk order (like +[`readable.map`][]), so a slow `fn` call on an early chunk delays completion +of the calls on later chunks. + This method is different from listening to the [`'data'`][] event in that it uses the [`readable`][] event in the underlying machinery and can limit the number of concurrent `fn` calls.