* Fix workflow * Trigger * [auto] Update compiled version * [auto] Commit modules * Push Windows changes * Fix * [auto] Update compiled version * Try removing cwd * [auto] Update compiled version * Try with path module * [auto] Update compiled version * Fix path * [auto] Update compiled version * Use raw path * [auto] Update compiled version * Other path * [auto] Update compiled version * Avoid @action/exec * [auto] Update compiled version * test * [auto] Update compiled version * test * [auto] Update compiled version * test * [auto] Update compiled version * test * [auto] Update compiled version * Try with shelljs * [auto] Update compiled version * Fix my stupidity * Copy scripts to local dir * [auto] Update compiled version * Still use path * [auto] Update compiled version * Delete entrypoint.sh * [auto] Update compiled version * Make file executable * [auto] Update compiled version * Try using bash * [auto] Update compiled version
42 lines
1.1 KiB
Markdown
42 lines
1.1 KiB
Markdown
# term-size [](https://travis-ci.org/sindresorhus/term-size) [](https://ci.appveyor.com/project/sindresorhus/term-size/branch/master)
|
|
|
|
> Reliably get the terminal window size
|
|
|
|
Because [`process.stdout.columns`](https://nodejs.org/api/tty.html#tty_writestream_columns) doesn't exist when run [non-interactively](http://www.tldp.org/LDP/abs/html/intandnonint.html), 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
|
|
|
|
```js
|
|
const termSize = require('term-size');
|
|
|
|
termSize();
|
|
//=> {columns: 143, rows: 24}
|
|
```
|
|
|
|
|
|
## API
|
|
|
|
### termSize()
|
|
|
|
Returns an `Object` with `columns` and `rows` properties.
|
|
|
|
|
|
## Related
|
|
|
|
- [term-size-cli](https://github.com/sindresorhus/term-size-cli) - CLI for this module
|
|
|
|
|
|
## License
|
|
|
|
MIT © [Sindre Sorhus](https://sindresorhus.com)
|