Skip to content

Commit

Permalink
doc: 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: nodejs#52818
PR-URL: nodejs#52842
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
  • Loading branch information
benjamingr authored and bmeck committed Jun 22, 2024
1 parent b1ca0dc commit 60e2d17
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 60e2d17

Please sign in to comment.