From 29fc4f2f14e1af9c70fc9282e225662d0b2cd496 Mon Sep 17 00:00:00 2001 From: George Sapkin Date: Thu, 8 Feb 2018 09:22:02 +0100 Subject: [PATCH] doc: add comments about Readable unpipe on Writable error event --- doc/api/stream.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/api/stream.md b/doc/api/stream.md index 345e0d824d5981..5eb0c061b5fa8a 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -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(); @@ -1533,6 +1536,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');