Get width of terminal in Node.js

console.log('Terminal size: ' + process.stdout.columns + 'x' + process.stdout.rows);

And the output looks like e.g. "Terminal size: 80x24". There is also an event if the console size changes.

It's explained under tty in the docs.