Socket
Socket
Sign inDemoInstall

term-size

Package Overview
Dependencies
0
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
4.3M
increased by0.12%
Maintainers
1
Install size
49.0 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

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

import terminalSize from 'term-size';

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

API

terminalSize()

Returns an object with columns and rows properties.

Info

The bundled macOS binary is signed and hardened.

  • term-size-cli - CLI for this module

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.

Keywords

FAQs

Last updated on 04 Nov 2023

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