Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cli-width

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-width

Get stdout window width, with two fallbacks, tty and then a default.

  • 4.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
29M
decreased by-2.07%
Maintainers
2
Weekly downloads
 
Created

What is cli-width?

The cli-width package is a simple utility that allows you to retrieve the current width of the command line interface (CLI) in which your node.js application is running. It is useful for creating CLI tools that need to format output according to the width of the terminal window.

What are cli-width's main functionalities?

Get CLI width

This feature allows you to get the current width of the CLI. The function returns a number representing the number of columns in the terminal, or a default value if it can't be determined.

const cliWidth = require('cli-width');
console.log(cliWidth());

Set default width

This feature allows you to set a default width that cli-width will return if it cannot determine the actual width of the terminal. This is useful for ensuring your application has a fallback width to use for formatting output.

const cliWidth = require('cli-width');
cliWidth.defaultWidth = 100;
console.log(cliWidth());

Other packages similar to cli-width

FAQs

Package last updated on 05 Aug 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc