Socket
Socket
Sign inDemoInstall

term-size

Package Overview
Dependencies
16
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    term-size

Reliably get the terminal window size (columns & rows)


Version published
Weekly downloads
3.2M
decreased by-23.65%
Maintainers
1
Install size
177 kB
Created
Weekly downloads
 

Package description

What is term-size?

The term-size npm package is a simple utility that allows you to get the size (width and height) of the terminal window in which your Node.js application is running. It's particularly useful for CLI applications that need to adjust their output based on the available terminal space.

What are term-size's main functionalities?

Get Terminal Size

This feature allows you to retrieve the current size of the terminal (width as columns and height as rows). The code sample demonstrates how to use term-size to get the terminal dimensions and then print them to the console.

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

const {columns, rows} = termSize();
console.log(`Columns: ${columns}, Rows: ${rows}`);

Other packages similar to term-size

Readme

Source

term-size Build Status: Linux & macOS Build Status: Windows

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 --save term-size

Usage

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

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

API

termSize()

Returns an Object with columns and rows properties.

  • term-size-cli - CLI for this module

License

MIT © Sindre Sorhus

Keywords

FAQs

Last updated on 26 Jun 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc