term-size

Reliably get the terminal window size (columns & rows)

MIT 14 个版本
安装
npm install term-size
yarn add term-size
pnpm add term-size
bun add term-size
README

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 term-size

Usage

import terminalSize from 'term-size';

terminalSize();
//=> {columns: 143, rows: 24}

API

terminalSize()

Returns an object with columns and rows properties.

Info

The bundled macOS binary is signed and hardened.


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.
版本列表
4.0.0 2023-11-04
3.0.2 2022-05-24
3.0.1 2021-10-07
3.0.0 2021-08-18
2.2.1 2020-10-25
2.2.0 2020-01-30
2.1.1 2019-12-18
2.1.0 2019-05-25
2.0.0 2019-04-28
1.2.0 2017-06-26
1.1.0 2017-05-07
1.0.0 2017-05-06
0.1.1 2017-02-03
0.1.0 2016-09-09