A Node.js module to reliably get terminal window dimensions, even in non-interactive environments.
terminal-size is a Node.js module that reliably retrieves the terminal window dimensions (columns and rows). It solves the problem where Node.js's built-in `process.stdout.columns` and `process.stdout.rows` are unavailable in non-interactive environments, such as child processes or when output is piped.
Node.js developers building CLI tools, scripts, or applications that need to adapt to terminal size in various execution contexts.
It provides a cross-platform, dependable solution for terminal size detection where native methods fail, ensuring consistent behavior in interactive and non-interactive scenarios.
Reliably get the terminal window size
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Confirmed to work on macOS, Linux, and Windows as stated in the README, ensuring consistent behavior across operating systems.
Functions correctly in child processes or when TTY file descriptors are redirected, solving the issue where process.stdout.columns is undefined in such scenarios.
Provides a single function call returning an object with columns and rows, making integration straightforward without complex configuration.
A minimal module dedicated solely to terminal size detection, with no unnecessary dependencies cluttering the project.
Only retrieves a static snapshot of terminal size; lacks event-driven methods or polling for handling terminal resizing dynamically.
Exclusively provides columns and rows, missing other terminal properties like color support or cursor position that might be needed for advanced CLI features.
For simple interactive scripts, adding an external module may be unnecessary overhead when native Node.js methods suffice.