mirror of https://github.com/nodejs/node.git
PR-URL: https://github.com/nodejs/node/pull/31459 Refs: https://github.com/nodejs/node/issues/29216 Refs: https://github.com/sindresorhus/macos-term-size/pull/3 Reviewed-By: Christian Clauss <cclauss@me.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Ash Cripps <ashley.cripps@ibm.com> Signed-off-by: Rod Vagg <rod@vagg.org> |
||
---|---|---|
.. | ||
vendor | ||
index.js | ||
license | ||
package.json | ||
readme.md |
readme.md
term-size

Reliably get the terminal window size
Because process.stdout.columns
doesn't exist when run non-interactively, for example, in a child process or when piped. This module even works when all the TTY file descriptors are redirected!
Confirmed working on macOS, Linux, and Windows.
Install
$ npm install --save term-size
Usage
const termSize = require('term-size');
termSize();
//=> {columns: 143, rows: 24}
API
termSize()
Returns an Object
with columns
and rows
properties.
Related
- term-size-cli - CLI for this module
License
MIT © Sindre Sorhus