From ae5d47dde395c25e8b82817c2aba55231f31a938 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 7485d1f026325a..18282e151e3df1 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