@@ -2504,23 +2504,23 @@ readable.on('data', (chunk) => {
2504
2504
2505
2505
#### Piping to Writable Streams from Async Iterators
2506
2506
2507
- In the scenario of writing to a writeable stream from an async iterator,
2507
+ In the scenario of writing to a writable stream from an async iterator,
2508
2508
it is important to ensure the correct handling of backpressure and errors.
2509
2509
2510
2510
``` js
2511
2511
const { once } = require (' events' );
2512
2512
2513
- const writeable = fs .createWriteStream (' ./file' );
2513
+ const writable = fs .createWriteStream (' ./file' );
2514
2514
2515
2515
(async function () {
2516
2516
for await (const chunk of iterator ) {
2517
2517
// Handle backpressure on write().
2518
- if (! writeable .write (chunk))
2519
- await once (writeable , ' drain' );
2518
+ if (! writable .write (chunk))
2519
+ await once (writable , ' drain' );
2520
2520
}
2521
- writeable .end ();
2521
+ writable .end ();
2522
2522
// Ensure completion without errors.
2523
- await once (writeable , ' finish' );
2523
+ await once (writable , ' finish' );
2524
2524
})();
2525
2525
```
2526
2526
@@ -2533,13 +2533,13 @@ then piped via `.pipe()`:
2533
2533
``` js
2534
2534
const { once } = require (' events' );
2535
2535
2536
- const writeable = fs .createWriteStream (' ./file' );
2536
+ const writable = fs .createWriteStream (' ./file' );
2537
2537
2538
2538
(async function () {
2539
2539
const readable = Readable .from (iterator);
2540
- readable .pipe (writeable );
2540
+ readable .pipe (writable );
2541
2541
// Ensure completion without errors.
2542
- await once (writeable , ' finish' );
2542
+ await once (writable , ' finish' );
2543
2543
})();
2544
2544
```
2545
2545
0 commit comments