Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Nov 8, 2021
1 parent 730908a commit fb8ed7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ usually not necessary to use the `stream` module to consume streams.
added: v0.11.3
-->

* {integer} **Default:** `Math.max(Buffer.poolSize, 16 * 1024)`
* {integer} **Default:** `16 * 1024`

This is the size (in bytes) for the default high water mark for
readable and writable streams. This value may be modified.
Expand Down
11 changes: 6 additions & 5 deletions lib/internal/streams/legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
const {
ArrayIsArray,
ObjectSetPrototypeOf,
MathMax
MathMax,
NumberIsInteger,
} = primordials;
const {
codes: {
Expand Down Expand Up @@ -119,13 +120,13 @@ function prependListener(emitter, event, fn) {
emitter._events[event] = [fn, emitter._events[event]];
}

let defaultHighWaterMark = null;
let defaultHighWaterMark = 16 * 1024;
ObjectDefineProperty(Stream, 'defaultHighWaterMark', {
get () {
return defaultHighWaterMark || MathMax(Buffer.poolSize, 16 * 1024);
return defaultHighWaterMark;
},
set (value) {
if (!Number.isInteger(value)) {
if (!NumberIsInteger(value)) {
throw ERR_INVALID_ARG_TYPE('value', 'Integer', value);
}

Expand All @@ -143,7 +144,7 @@ ObjectDefineProperty(Stream, 'defaultObjectModeHighWaterMark', {
return defaultObjectModeHighWaterMark;
},
set (value) {
if (!Number.isInteger(value)) {
if (!NumberIsInteger(value)) {
throw ERR_INVALID_ARG_TYPE('value', 'Integer', value);
}

Expand Down

0 comments on commit fb8ed7e

Please sign in to comment.