Node.js Stream readable.readableFlowing Property
The readable.readableFlowing property in a readable stream that utilized to check if the streams are in flowing mode or not.
Syntax:
readable.readableFlowing
Return Value: It returns true if stream is in flowing mode else it returns false.
Below examples illustrate the use of readable.readableFlowing property in Node.js:
Example 1:
var fs = require( "fs" );
var data = '' ;
var readerStream = fs.createReadStream( 'input.txt' );
readerStream.on( 'data' , function (chunk) {
data += chunk;
});
readerStream.readableFlowing;
|
Output:
true
Example 2:
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.readableFlowing;
|
Output:
false
Reference: https://nodejs.org/api/stream.html#stream_readable_readableflowing.
Last Updated :
12 Oct, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...