From de1246cfa91eab1a16cdd374899df7b29ad266fc Mon Sep 17 00:00:00 2001 From: umuoy1 Date: Mon, 20 Jul 2026 16:27:01 +0800 Subject: [PATCH] doc: correct default highWaterMark values File write streams inherit the default byte-stream highWaterMark. The fixed 16 KiB value became stale when that default changed. Also document the Windows-specific byte-stream default. Signed-off-by: umuoy1 --- doc/api/fs.md | 13 +++++++++++-- doc/api/stream.md | 14 ++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index f1a1b9a9a273..b02c337a6abe 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -323,6 +323,9 @@ fd.createReadStream({ start: 90, end: 99 }); * `objectMode` {boolean} * Returns: {integer} -Returns the default highWaterMark used by streams. -Defaults to `65536` (64 KiB), or `16` for `objectMode`. +Returns the default highWaterMark used by streams. Defaults to `16` for +`objectMode`. For byte streams, it defaults to `65536` (64 KiB) on non-Windows +platforms and `16384` (16 KiB) on Windows. ### `stream.setDefaultHighWaterMark(objectMode, value)` @@ -3783,7 +3788,7 @@ changes: * `options` {Object} * `highWaterMark` {number} Buffer level when [`stream.write()`][stream-write] starts returning `false`. **Default:** - `65536` (64 KiB), or `16` for `objectMode` streams. + See [`stream.getDefaultHighWaterMark()`][]. * `decodeStrings` {boolean} Whether to encode `string`s passed to [`stream.write()`][stream-write] to `Buffer`s (with the encoding specified in the [`stream.write()`][stream-write] call) before passing @@ -4157,7 +4162,7 @@ changes: * `options` {Object} * `highWaterMark` {number} The maximum [number of bytes][hwm-gotcha] to store in the internal buffer before ceasing to read from the underlying resource. - **Default:** `65536` (64 KiB), or `16` for `objectMode` streams. + **Default:** See [`stream.getDefaultHighWaterMark()`][]. * `encoding` {string} If specified, then buffers will be decoded to strings using the specified encoding. **Default:** `null`. * `objectMode` {boolean} Whether this stream should behave @@ -5098,6 +5103,7 @@ contain multi-byte characters. [`stream.cork()`]: #writablecork [`stream.duplexPair()`]: #streamduplexpairoptions [`stream.finished()`]: #streamfinishedstream-options-callback +[`stream.getDefaultHighWaterMark()`]: #streamgetdefaulthighwatermarkobjectmode [`stream.pipe()`]: #readablepipedestination-options [`stream.pipeline()`]: #streampipelinesource-transforms-destination-callback [`stream.uncork()`]: #writableuncork