From 4f6b1870590289aa6054f2436ffcf1d4e4978c0f Mon Sep 17 00:00:00 2001 From: Randall Leeds Date: Mon, 14 Mar 2022 16:43:31 -0700 Subject: [PATCH] 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 Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- doc/api/stream.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index 3d701b1b0b625f..341b7c12e37204 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'; },