Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

4 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # term-size [![Build Status](https://travis-ci.com/sindresorhus/term-size.svg?branch=master)](https://travis-ci.com/github/sindresorhus/term-size)
  2. > Reliably get the terminal window size
  3. 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!
  4. Confirmed working on macOS, Linux, and Windows.
  5. ## Install
  6. ```
  7. $ npm install term-size
  8. ```
  9. ## Usage
  10. ```js
  11. const termSize = require('term-size');
  12. termSize();
  13. //=> {columns: 143, rows: 24}
  14. ```
  15. ## API
  16. ### termSize()
  17. Returns an `object` with `columns` and `rows` properties.
  18. ## Info
  19. The bundled macOS binary is signed and hardened.
  20. ## Related
  21. - [term-size-cli](https://github.com/sindresorhus/term-size-cli) - CLI for this module
  22. ---
  23. <div align="center">
  24. <b>
  25. <a href="https://tidelift.com/subscription/pkg/npm-term-size?utm_source=npm-term-size&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
  26. </b>
  27. <br>
  28. <sub>
  29. Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
  30. </sub>
  31. </div>