Skip to content

Commit

Permalink
doc: document watermark string behavior
Browse files Browse the repository at this point in the history
Documents that we calculate the highWaterMark value of streams operating on strings using the number of UTF-16 code units.

Fixes: #52818
  • Loading branch information
benjamingr committed May 5, 2024
1 parent 54f1e0a commit a5c8454
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a5c8454

Please sign in to comment.