From 761d2ce43cc5c996f4bdc5b873384eb4f2346488 Mon Sep 17 00:00:00 2001 From: Benjamin Gruenbaum Date: Fri, 10 May 2024 20:58:40 +0300 Subject: [PATCH] doc: watermark string behavior Documents that we calculate the highWaterMark value of streams operating on strings using the number of UTF-16 code units. Fixes: https://github.com/nodejs/node/issues/52818 PR-URL: https://github.com/nodejs/node/pull/52842 Reviewed-By: Luigi Pinca Reviewed-By: Robert Nagy Reviewed-By: Matteo Collina --- doc/api/stream.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/stream.md b/doc/api/stream.md index 03a2d8d72d7807..808e7a6b8f2634 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -317,7 +317,9 @@ buffer. The amount of data potentially buffered depends on the `highWaterMark` option passed into the stream's constructor. For normal streams, the `highWaterMark` option specifies a [total number of bytes][hwm-gotcha]. For streams operating -in object mode, the `highWaterMark` specifies a total number of objects. +in object mode, the `highWaterMark` specifies a total number of objects. For +streams operating on (but not decoding) strings, the `highWaterMark` specifies +a total number of UTF-16 code units. Data is buffered in `Readable` streams when the implementation calls [`stream.push(chunk)`][stream-push]. If the consumer of the Stream does not