Node.js Stream readable.readableHighWaterMark Property
The readable.readableHighWaterMark property in a readable stream that is used to check the value of highWaterMark used while constructing Readable streams.
Syntax:
readable.readableHighWaterMark
Return Value: It returns the value of highWaterMark used while constructing Readable streams.
Below examples illustrate the use of readable.readableHighWaterMark property in Node.js:
Example 1:
const fs = require( "fs" );
const readable = fs.createReadStream( "input.txt" );
readable.on( 'readable' , () => {
let chunk;
while ( null !== (chunk = readable.read())) {
console.log(`read: ${chunk}`);
}
});
readable.readableHighWaterMark;
|
Output:
65536
read: GeeksforGeeks
Example 2:
const stream = require( 'stream' );
const readable = new stream.Readable({
highWaterMark: 1234
});
readable.readableHighWaterMark;
|
Output:
1234
Reference: https://nodejs.org/api/stream.html#stream_readable_readablehighwatermark.
Last Updated :
12 Oct, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...