mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
e7b5c0ed47
Adds stream.(get|set)DefaultHighWaterMark to read or update the default hwm. PR-URL: https://github.com/nodejs/node/pull/46929 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Erick Wendel <erick.workspace@gmail.com>
37 lines
877 B
JavaScript
37 lines
877 B
JavaScript
'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);
|