package
Reliably get the terminal window size (columns & rows)
npm install term-sizeGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
49.0 kB
Includes dependencies.
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.
$ npm install term-sizeimport terminalSize from 'term-size';
terminalSize();
//=> {columns: 143, rows: 24}Returns an object with columns and rows properties.
The bundled macOS binary is signed and hardened.