From d2e3ea5b9448421cb0aa2b6695b8b613b35fddd8 Mon Sep 17 00:00:00 2001 From: Benjamin Gruenbaum Date: Sat, 16 May 2020 14:53:36 +0300 Subject: [PATCH] doc: add comment about highWaterMark limit Add a comment regarding memory limits and setting highWaterMark PR-URL: https://github.com/nodejs/node/pull/33432 Reviewd-By: Colin Ihrig Reviewed-By: Robert Nagy --- doc/api/stream.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/api/stream.md b/doc/api/stream.md index 2801d2e7e8d4dd..6dda48f9a25d64 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -93,6 +93,11 @@ A key goal of the `stream` API, particularly the [`stream.pipe()`][] method, is to limit the buffering of data to acceptable levels such that sources and destinations of differing speeds will not overwhelm the available memory. +The `highWaterMark` option is a threshold, not a limit: it dictates the amount +of data that a stream buffers before it stops asking for more data. It does not +enforce a strict memory limitation in general. Specific stream implementations +may choose to enforce stricter limits but doing so is optional. + Because [`Duplex`][] and [`Transform`][] streams are both `Readable` and `Writable`, each maintains *two* separate internal buffers used for reading and writing, allowing each side to operate independently of the other while