Skip to content

Commit b83e81c

Browse files
tilgovixtx1130
authored andcommitted
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: nodejs#42258 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 1efdc7c commit b83e81c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc/api/stream.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2532,7 +2532,7 @@ const fs = require('fs');
25322532
async function run() {
25332533
await pipeline(
25342534
fs.createReadStream('lowercase.txt'),
2535-
async function* (source, signal) {
2535+
async function* (source, { signal }) {
25362536
source.setEncoding('utf8'); // Work with strings rather than `Buffer`s.
25372537
for await (const chunk of source) {
25382538
yield await processChunk(chunk, { signal });
@@ -2556,7 +2556,7 @@ const fs = require('fs');
25562556

25572557
async function run() {
25582558
await pipeline(
2559-
async function * (signal) {
2559+
async function* ({ signal }) {
25602560
await someLongRunningfn({ signal });
25612561
yield 'asd';
25622562
},

0 commit comments

Comments
 (0)