Skip to content

Commit

Permalink
doc: Readable unpipe on Writable error event
Browse files Browse the repository at this point in the history
PR-URL: nodejs#18080
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
GeorgeSapkin authored and MayaLekova committed May 8, 2018
1 parent 0c30e65 commit e2dc2bd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ The `'unpipe'` event is emitted when the [`stream.unpipe()`][] method is called
on a [Readable][] stream, removing this [Writable][] from its set of
destinations.

This is also emitted in case this [Writable][] stream emits an error when a
[Readable][] stream pipes into it.

```js
const writer = getWritableStreamSomehow();
const reader = getReadableStreamSomehow();
Expand Down Expand Up @@ -1545,6 +1548,9 @@ the callback and passing the error as the first argument. This will cause an
on how the stream is being used. Using the callback ensures consistent and
predictable handling of errors.

If a Readable stream pipes into a Writable stream when Writable emits an
error, the Readable stream will be unpiped.

```js
const { Writable } = require('stream');

Expand Down

0 comments on commit e2dc2bd

Please sign in to comment.