From c3cc30e8ee0fba677d791e8f78bc3b39e1ff2533 Mon Sep 17 00:00:00 2001 From: Feng Yu Date: Mon, 6 Jun 2022 03:56:21 +0800 Subject: [PATCH] doc: add missing require to stream api doc PR-URL: https://github.com/nodejs/node/pull/43237 Reviewed-By: Antoine du Hamel --- doc/api/stream.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/api/stream.md b/doc/api/stream.md index 5d197f18900020..56dde8cb77c681 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1182,6 +1182,7 @@ making it possible to set up chains of piped streams: ```js const fs = require('node:fs'); +const zlib = require('node:zlib'); const r = fs.createReadStream('file.txt'); const z = zlib.createGzip(); const w = fs.createWriteStream('file.txt.gz'); @@ -2316,6 +2317,7 @@ or has experienced an error or a premature close event. ```js const { finished } = require('node:stream'); +const fs = require('node:fs'); const rs = fs.createReadStream('archive.tar'); @@ -2338,6 +2340,7 @@ The `finished` API provides promise version: ```js const { finished } = require('node:stream/promises'); +const fs = require('node:fs'); const rs = fs.createReadStream('archive.tar'); @@ -2431,6 +2434,8 @@ receive an options argument as the last parameter with a ```js const { pipeline } = require('node:stream/promises'); +const fs = require('node:fs'); +const zlib = require('node:zlib'); async function run() { await pipeline( @@ -2449,6 +2454,8 @@ as the last argument: ```js const { pipeline } = require('node:stream/promises'); +const fs = require('node:fs'); +const zlib = require('node:zlib'); async function run() { const ac = new AbortController();