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 <burningdian@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/64617
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
Yilong Li authored and Antoine du Hamel committed 2026-08-26 00:55:33 +02:00
1 parent b6fa9c1819
commit 3b8a0bacaa
2 files changed
+21 -6

No files matched your search

+11 -2
View File
@@ -323,6 +323,9 @@ fd.createReadStream({ start: 90, end: 99 });
<!-- YAML
added: v16.11.0
changes:
- version: v22.0.0
pr-url: https://github.com/nodejs/node/pull/52037
description: bump default highWaterMark.
- version:
- v21.0.0
- v20.10.0
@@ -335,7 +338,8 @@ changes:
* `autoClose` {boolean} **Default:** `true`
* `emitClose` {boolean} **Default:** `true`
* `start` {integer}
* `highWaterMark` {number} **Default:** `16384`
* `highWaterMark` {number} **Default:** See
[`stream.getDefaultHighWaterMark()`][].
* `flush` {boolean} If `true`, the underlying file descriptor is flushed
prior to closing it. **Default:** `false`.
* Returns: {fs.WriteStream}
@@ -3055,6 +3059,9 @@ If `options` is a string, then it specifies the encoding.
<!-- YAML
added: v0.1.31
changes:
- version: v22.0.0
pr-url: https://github.com/nodejs/node/pull/52037
description: bump default highWaterMark.
- version:
- v21.0.0
- v20.10.0
@@ -3112,7 +3119,8 @@ changes:
* `start` {integer}
* `fs` {Object|null} **Default:** `null`
* `signal` {AbortSignal|null} **Default:** `null`
* `highWaterMark` {number} **Default:** `16384`
* `highWaterMark` {number} **Default:** See
[`stream.getDefaultHighWaterMark()`][].
* `flush` {boolean} If `true`, the underlying file descriptor is flushed
prior to closing it. **Default:** `false`.
* Returns: {fs.WriteStream}
@@ -9334,6 +9342,7 @@ the file contents.
[`minimatch`]: https://github.com/isaacs/minimatch
[`node:stream/iter`]: stream_iter.md
[`statfs.bsize`]: #statfsbsize
[`stream.getDefaultHighWaterMark()`]: stream.md#streamgetdefaulthighwatermarkobjectmode
[`stream/iter pipeTo()`]: stream_iter.md#pipetosource-transforms-writer-options
[`stream/iter pull()`]: stream_iter.md#pullsource-transforms-options
[`stream/iter pullSync()`]: stream_iter.md#pullsyncsource-transforms
+10 -4
View File
@@ -3643,13 +3643,18 @@ reader.read().then(({ value, done }) => {
added:
- v19.9.0
- v18.17.0
changes:
- version: v22.0.0
pr-url: https://github.com/nodejs/node/pull/52037
description: bump default highWaterMark.
-->
* `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)`
@@ -3779,7 +3784,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
@@ -4153,7 +4158,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
@@ -5094,6 +5099,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