How wide is the node.js console?

console, node.js

Solution

Looks like the current best way is this property:

process.stdout.columns

And for height (rows):

process.stdout.rows

Also note that there is a "resize" event, which might come in handy:

process.stdout.on('resize', function() {
  console.log('screen size has changed!');
  console.log(process.stdout.columns + 'x' + process.stdout.rows);
});

Documentation here: http://nodejs.org/api/tty.html#tty_tty

Problem

In node.js, how do I get the current width of the console window and/or buffer? The analog in .net is Console.BufferWidth and/or Console.WindowWidth. I want to exercise more control over my line wrapping.

Original source