terminal-size
Reliably get the terminal window size (columns & rows)
Last updated 2 months ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install terminal-size 
SYNC missed versions from official npm registry.

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

Usage

import terminalSize from 'terminal-size';

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

API

terminalSize()

Returns an object with columns and rows properties.

Related

Current Tags

  • 4.0.1                                ...           latest (2 months ago)

2 Versions

  • 4.0.1                                ...           2 months ago
  • 4.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (4)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |