-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stream: add setter & getter for default highWaterMark (#46929)
Adds stream.(get|set)DefaultHighWaterMark to read or update the default hwm. PR-URL: #46929 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Erick Wendel <[email protected]>
- Loading branch information
Showing
5 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
|
||
const assert = require('node:assert'); | ||
const { | ||
setDefaultHighWaterMark, | ||
getDefaultHighWaterMark, | ||
Writable, | ||
Readable, | ||
Transform | ||
} = require('stream'); | ||
|
||
assert.notStrictEqual(getDefaultHighWaterMark(false), 32 * 1000); | ||
setDefaultHighWaterMark(false, 32 * 1000); | ||
assert.strictEqual(getDefaultHighWaterMark(false), 32 * 1000); | ||
|
||
assert.notStrictEqual(getDefaultHighWaterMark(true), 32); | ||
setDefaultHighWaterMark(true, 32); | ||
assert.strictEqual(getDefaultHighWaterMark(true), 32); | ||
|
||
const w = new Writable({ | ||
write() {} | ||
}); | ||
assert.strictEqual(w.writableHighWaterMark, 32 * 1000); | ||
|
||
const r = new Readable({ | ||
read() {} | ||
}); | ||
assert.strictEqual(r.readableHighWaterMark, 32 * 1000); | ||
|
||
const t = new Transform({ | ||
transform() {} | ||
}); | ||
assert.strictEqual(t.writableHighWaterMark, 32 * 1000); | ||
assert.strictEqual(t.readableHighWaterMark, 32 * 1000); |