Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
vendor/ | 12-May-2024 | - | ||||
index.js | D | 12-May-2024 | 1.7 KiB | 71 | 52 | |
license | D | 12-May-2024 | 1.1 KiB | 22 | 17 | |
package.json | D | 12-May-2024 | 1.6 KiB | 76 | 75 | |
readme.md | D | 12-May-2024 | 1.1 KiB | 42 | 21 |
readme.md
1# term-size [![Build Status: Linux & macOS](https://travis-ci.org/sindresorhus/term-size.svg?branch=master)](https://travis-ci.org/sindresorhus/term-size) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/c3tydg6uedsk0bob/branch/master?svg=true)](https://ci.appveyor.com/project/sindresorhus/term-size/branch/master) 2 3> Reliably get the terminal window size 4 5Because [`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! 6 7Confirmed working on macOS, Linux, and Windows. 8 9 10## Install 11 12``` 13$ npm install --save term-size 14``` 15 16 17## Usage 18 19```js 20const termSize = require('term-size'); 21 22termSize(); 23//=> {columns: 143, rows: 24} 24``` 25 26 27## API 28 29### termSize() 30 31Returns an `Object` with `columns` and `rows` properties. 32 33 34## Related 35 36- [term-size-cli](https://github.com/sindresorhus/term-size-cli) - CLI for this module 37 38 39## License 40 41MIT © [Sindre Sorhus](https://sindresorhus.com) 42