Node.js writeStream.rows Property
Last Updated :
06 Sep, 2020
The writeStream.rows property is an inbuilt application programming interface of class WriteStream within tty module which is used to get the number of rows this write Stream object has.
Syntax:
const writeStream.rows
Parameters: This property does not hold any parameter.
Return Value: This property returns the number of rows this write Stream object has.
Example 1: Filename: index.js
var dgram = require( 'dgram' );
var client = dgram.createSocket( "udp4" );
var server = dgram.createSocket( "udp4" );
server.on( "message" , function (msg) {
let WriteStream = process.stdout;
const col = WriteStream.rows;
process.stdout.write(msg + col);
process.exit();
})
.bind(1234, () => {
});
client.send( "Number of rows :- " ,
0, 21, 1234, "localhost" );
|
Output:
Number of rows :- 10
Example 2: Filename: index.js
let WriteStream = process.stdout;
const col = WriteStream.rows;
console.log( "Number of rows :- " + col);
|
Run the index.js file using the following command:
node index.js
Output:
Number of rows :- 10
Reference: https://nodejs.org/dist/latest-v12.x/docs/api/tty.html#tty_writestream_rows
Share your thoughts in the comments
Please Login to comment...