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

term-size Build Status

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

const termSize = require('term-size');

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

API

termSize()

Returns an object with columns and rows properties.

Info

The bundled macOS binary is signed and hardened.

Related


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.

Current Tags

  • 3.0.1                                ...           latest (4 years ago)

4 Versions

  • 3.0.1                                ...           4 years ago
  • 2.2.1                                ...           5 years ago
  • 1.2.0                                ...           8 years ago
  • 2.2.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org