diff options
author | Randall Leeds <randall@bleeds.info> | 2022-03-14 16:43:31 -0700 |
---|---|---|
committer | Danielle Adams <adamzdanielle@gmail.com> | 2022-04-23 22:47:19 -0400 |
commit | 4f6b1870590289aa6054f2436ffcf1d4e4978c0f (patch) | |
tree | e3090f081bd2f238ccad1e69f40f8838670fd865 /doc | |
parent | 3188dcb390f373f439ccfb59dfdf2db95445fdb8 (diff) | |
download | node-new-4f6b1870590289aa6054f2436ffcf1d4e4978c0f.tar.gz |
doc: fix async iterable pipeline signal examples
Fix the pipeline examples to show that async generators receive
an AbortSignal wrapped in an object.
PR-URL: https://github.com/nodejs/node/pull/42258
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/stream.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/doc/api/stream.md b/doc/api/stream.md index 3d701b1b0b..341b7c12e3 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2419,7 +2419,7 @@ const fs = require('fs'); async function run() { await pipeline( fs.createReadStream('lowercase.txt'), - async function* (source, signal) { + async function* (source, { signal }) { source.setEncoding('utf8'); // Work with strings rather than `Buffer`s. for await (const chunk of source) { yield await processChunk(chunk, { signal }); @@ -2443,7 +2443,7 @@ const fs = require('fs'); async function run() { await pipeline( - async function * (signal) { + async function* ({ signal }) { await someLongRunningfn({ signal }); yield 'asd'; }, |