Skip to content

Commit 459f209

Browse files
GeorgeSapkinaddaleax
authored andcommitted
doc: Readable unpipe on Writable error event
PR-URL: #18080 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 1b32fc3 commit 459f209

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/api/stream.md

+6
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ The `'unpipe'` event is emitted when the [`stream.unpipe()`][] method is called
323323
on a [Readable][] stream, removing this [Writable][] from its set of
324324
destinations.
325325

326+
This is also emitted in case this [Writable][] stream emits an error when a
327+
[Readable][] stream pipes into it.
328+
326329
```js
327330
const writer = getWritableStreamSomehow();
328331
const reader = getReadableStreamSomehow();
@@ -1496,6 +1499,9 @@ the callback and passing the error as the first argument. This will cause an
14961499
on how the stream is being used. Using the callback ensures consistent and
14971500
predictable handling of errors.
14981501

1502+
If a Readable stream pipes into a Writable stream when Writable emits an
1503+
error, the Readable stream will be unpiped.
1504+
14991505
```js
15001506
const { Writable } = require('stream');
15011507

0 commit comments

Comments
 (0)