Skip to content

Commit 7f6e0b3

Browse files
GeorgeSapkinMylesBorins
authored andcommitted
doc: Readable unpipe on Writable error event
Backport-PR-URL: #22380 PR-URL: #18080 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent ce66b02 commit 7f6e0b3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

doc/api/stream.md

Lines changed: 6 additions & 0 deletions
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();
@@ -1485,6 +1488,9 @@ the callback and passing the error as the first argument. This will cause an
14851488
on how the stream is being used. Using the callback ensures consistent and
14861489
predictable handling of errors.
14871490

1491+
If a Readable stream pipes into a Writable stream when Writable emits an
1492+
error, the Readable stream will be unpiped.
1493+
14881494
```js
14891495
const { Writable } = require('stream');
14901496

0 commit comments

Comments
 (0)