FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

doc: correct default highWaterMark values · nodejs/node@3b8a0ba · GitHub

/ node Public

Commit 3b8a0ba

Browse files
authored andcommitted
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: #64617 Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent b6fa9c1 commit 3b8a0ba

2 files changed

Lines changed: 21 additions & 6 deletions

File tree

‎doc/api/fs.md‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,9 @@ fd.createReadStream({ start: 90, end: 99 });
323323
<!-- YAML
324324
added: v16.11.0
325325
changes:
326+
- version: v22.0.0
327+
pr-url: https://github.com/nodejs/node/pull/52037
328+
description: bump default highWaterMark.
326329
- version:
327330
- v21.0.0
328331
- v20.10.0
@@ -335,7 +338,8 @@ changes:
335338
* `autoClose` {boolean} **Default:** `true`
336339
* `emitClose` {boolean} **Default:** `true`
337340
* `start` {integer}
338-
* `highWaterMark` {number} **Default:** `16384`
341+
* `highWaterMark` {number} **Default:** See
342+
[`stream.getDefaultHighWaterMark()`][].
339343
* `flush` {boolean} If `true`, the underlying file descriptor is flushed
340344
prior to closing it. **Default:** `false`.
341345
* Returns: {fs.WriteStream}
@@ -3055,6 +3059,9 @@ If `options` is a string, then it specifies the encoding.
30553059
<!-- YAML
30563060
added: v0.1.31
30573061
changes:
3062+
- version: v22.0.0
3063+
pr-url: https://github.com/nodejs/node/pull/52037
3064+
description: bump default highWaterMark.
30583065
- version:
30593066
- v21.0.0
30603067
- v20.10.0
@@ -3112,7 +3119,8 @@ changes:
31123119
* `start` {integer}
31133120
* `fs` {Object|null} **Default:** `null`
31143121
* `signal` {AbortSignal|null} **Default:** `null`
3115-
* `highWaterMark` {number} **Default:** `16384`
3122+
* `highWaterMark` {number} **Default:** See
3123+
[`stream.getDefaultHighWaterMark()`][].
31163124
* `flush` {boolean} If `true`, the underlying file descriptor is flushed
31173125
prior to closing it. **Default:** `false`.
31183126
* Returns: {fs.WriteStream}
@@ -9334,6 +9342,7 @@ the file contents.
93349342
[`minimatch`]: https://github.com/isaacs/minimatch
93359343
[`node:stream/iter`]: stream_iter.md
93369344
[`statfs.bsize`]: #statfsbsize
9345+
[`stream.getDefaultHighWaterMark()`]: stream.md#streamgetdefaulthighwatermarkobjectmode
93379346
[`stream/iter pipeTo()`]: stream_iter.md#pipetosource-transforms-writer-options
93389347
[`stream/iter pull()`]: stream_iter.md#pullsource-transforms-options
93399348
[`stream/iter pullSync()`]: stream_iter.md#pullsyncsource-transforms

‎doc/api/stream.md‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3643,13 +3643,18 @@ reader.read().then(({ value, done }) => {
36433643
added:
36443644
- v19.9.0
36453645
- v18.17.0
3646+
changes:
3647+
- version: v22.0.0
3648+
pr-url: https://github.com/nodejs/node/pull/52037
3649+
description: bump default highWaterMark.
36463650
-->
36473651

36483652
* `objectMode` {boolean}
36493653
* Returns: {integer}
36503654

3651-
Returns the default highWaterMark used by streams.
3652-
Defaults to `65536` (64 KiB), or `16` for `objectMode`.
3655+
Returns the default highWaterMark used by streams. Defaults to `16` for
3656+
`objectMode`. For byte streams, it defaults to `65536` (64 KiB) on non-Windows
3657+
platforms and `16384` (16 KiB) on Windows.
36533658

36543659
### `stream.setDefaultHighWaterMark(objectMode, value)`
36553660

@@ -3779,7 +3784,7 @@ changes:
37793784
* `options` {Object}
37803785
* `highWaterMark` {number} Buffer level when
37813786
[`stream.write()`][stream-write] starts returning `false`. **Default:**
3782-
`65536` (64 KiB), or `16` for `objectMode` streams.
3787+
See [`stream.getDefaultHighWaterMark()`][].
37833788
* `decodeStrings` {boolean} Whether to encode `string`s passed to
37843789
[`stream.write()`][stream-write] to `Buffer`s (with the encoding
37853790
specified in the [`stream.write()`][stream-write] call) before passing
@@ -4153,7 +4158,7 @@ changes:
41534158
* `options` {Object}
41544159
* `highWaterMark` {number} The maximum [number of bytes][hwm-gotcha] to store
41554160
in the internal buffer before ceasing to read from the underlying resource.
4156-
**Default:** `65536` (64 KiB), or `16` for `objectMode` streams.
4161+
**Default:** See [`stream.getDefaultHighWaterMark()`][].
41574162
* `encoding` {string} If specified, then buffers will be decoded to
41584163
strings using the specified encoding. **Default:** `null`.
41594164
* `objectMode` {boolean} Whether this stream should behave
@@ -5094,6 +5099,7 @@ contain multi-byte characters.
50945099
[`stream.cork()`]: #writablecork
50955100
[`stream.duplexPair()`]: #streamduplexpairoptions
50965101
[`stream.finished()`]: #streamfinishedstream-options-callback
5102+
[`stream.getDefaultHighWaterMark()`]: #streamgetdefaulthighwatermarkobjectmode
50975103
[`stream.pipe()`]: #readablepipedestination-options
50985104
[`stream.pipeline()`]: #streampipelinesource-transforms-destination-callback
50995105
[`stream.uncork()`]: #writableuncork

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL