| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1215,6 +1215,7 @@ making it possible to set up chains of piped streams: | |||
| 1215 | 1215 | ||
| 1216 | 1216 | ```js | |
| 1217 | 1217 | const fs = require('node:fs'); | |
| 1218 | + const zlib = require('node:zlib'); | ||
| 1218 | 1219 | const r = fs.createReadStream('file.txt'); | |
| 1219 | 1220 | const z = zlib.createGzip(); | |
| 1220 | 1221 | const w = fs.createWriteStream('file.txt.gz'); | |
@@ -2363,6 +2364,7 @@ or has experienced an error or a premature close event. | |||
| 2363 | 2364 | ||
| 2364 | 2365 | ```js | |
| 2365 | 2366 | const { finished } = require('node:stream'); | |
| 2367 | + const fs = require('node:fs'); | ||
| 2366 | 2368 | ||
| 2367 | 2369 | const rs = fs.createReadStream('archive.tar'); | |
| 2368 | 2370 | ||
@@ -2385,6 +2387,7 @@ The `finished` API provides promise version: | |||
| 2385 | 2387 | ||
| 2386 | 2388 | ```js | |
| 2387 | 2389 | const { finished } = require('node:stream/promises'); | |
| 2390 | + const fs = require('node:fs'); | ||
| 2388 | 2391 | ||
| 2389 | 2392 | const rs = fs.createReadStream('archive.tar'); | |
| 2390 | 2393 | ||
@@ -2483,6 +2486,8 @@ receive an options argument as the last parameter with a | |||
| 2483 | 2486 | ||
| 2484 | 2487 | ```js | |
| 2485 | 2488 | const { pipeline } = require('node:stream/promises'); | |
| 2489 | + const fs = require('node:fs'); | ||
| 2490 | + const zlib = require('node:zlib'); | ||
| 2486 | 2491 | ||
| 2487 | 2492 | async function run() { | |
| 2488 | 2493 | await pipeline( | |
@@ -2501,6 +2506,8 @@ as the last argument: | |||
| 2501 | 2506 | ||
| 2502 | 2507 | ```js | |
| 2503 | 2508 | const { pipeline } = require('node:stream/promises'); | |
| 2509 | + const fs = require('node:fs'); | ||
| 2510 | + const zlib = require('node:zlib'); | ||
| 2504 | 2511 | ||
| 2505 | 2512 | async function run() { | |
| 2506 | 2513 | const ac = new AbortController(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments