Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including term-size with all npm packages installed. Try it out:

var termSize = require("term-size")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

term-size v2.2.1

Reliably get the terminal window size (columns & rows)

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.


$ npm install term-size


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

//=> {columns: 143, rows: 24}



Returns an object with columns and rows properties.


The bundled macOS binary is signed and hardened.


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.


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free