Node.js Stream writable.writableHighWaterMark Property
Last Updated :
12 Oct, 2021
The writable.writableHighWaterMark property is an inbuilt application programming interface of stream module which is used to check the highWaterMark value which was passed while creating the Writable.
Syntax:
writable.writableHighWaterMark
Return Value: It returns the value of highwatermark if it is set otherwise returns the default value.
Below examples illustrate the use of writable.writableHighWaterMark property in Node.js:
Example 1:
const stream = require( 'stream' );
const writable = new stream.Writable({
write: function (chunk, encoding, next) {
console.log(chunk.toString());
next();
}
});
writable.write( 'hi' );
writable.write( 'GFG' );
writable.writableHighWaterMark;
|
Output:
hi
GFG
16384
Here, the default value is returned.
Example 2:
const stream = require( 'stream' );
const writable = new stream.Writable({
highWaterMark: 1234
});
writable.writableHighWaterMark;
|
Output:
1234
Here, the value of highWaterMark which was set while creating Writable stream is returned.
Reference: https://nodejs.org/api/stream.html#stream_writable_writablehighwatermark
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...