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