From fd7e4ab654b479e68e158797eaf3945b857fdb24 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 5df33ee5c6fa07..ff32f976229568 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -2469,7 +2469,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 }); @@ -2493,7 +2493,7 @@ const fs = require('fs'); async function run() { await pipeline( - async function * (signal) { + async function* ({ signal }) { await someLongRunningfn({ signal }); yield 'asd'; },