From 00f7cc65a1e2c46b0639dc6c1cf0b3154aef8cfe Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Wed, 9 Oct 2019 08:45:00 +0200 Subject: [PATCH] doc: add note of caution about non-conforming streams PR-URL: https://github.com/nodejs/node/pull/29895 Reviewed-By: Luigi Pinca Reviewed-By: Matteo Collina Reviewed-By: Anna Henningsen Reviewed-By: Ruben Bridgewater Reviewed-By: David Carlier Reviewed-By: Denys Otrishko Reviewed-By: Yorkie Liu Reviewed-By: Rich Trott --- doc/api/stream.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/api/stream.md b/doc/api/stream.md index 2143a84926c8db..4e3efde0752261 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1692,6 +1692,13 @@ of a stream that are intended for use by consumers (as described in the [API for Stream Consumers][] section). Doing so may lead to adverse side effects in application code consuming the stream. +Avoid overriding public methods such as `write()`, `end()`, `cork()`, +`uncork()`, `read()` and `destroy()`, or emitting internal events such +as `'error'`, `'data'`, `'end'`, `'finish'` and `'close'` through `.emit()`. +Doing so can break current and future stream invariants leading to behavior +and/or compatibility issues with other streams, stream utilities, and user +expectations. + ### Simplified Construction