Socket
Socket
Sign inDemoInstall

strip-ansi

Package Overview
Dependencies
0
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    strip-ansi

Strip ANSI escape codes (used for colorizing strings in the terminal)


Version published
Weekly downloads
164M
decreased by-0.41%
Maintainers
1
Install size
3.47 kB
Created
Weekly downloads
 

Package description

What is strip-ansi?

The strip-ansi npm package is used to remove ANSI escape codes from strings. These codes are often used to provide coloring and formatting in terminal output, but they can be problematic when the text needs to be processed without these codes, such as logging to a file or displaying in a GUI.

What are strip-ansi's main functionalities?

Strip ANSI escape codes from a string

This feature allows you to remove any ANSI escape codes from a given string, leaving only the plain text without any formatting or color.

const stripAnsi = require('strip-ansi');
const coloredString = '\u001B[4mUnicorn\u001B[0m';
const strippedString = stripAnsi(coloredString);
console.log(strippedString); // 'Unicorn'

Other packages similar to strip-ansi

Readme

Source

strip-ansi Build Status

Strip ANSI escape codes (used for colorizing strings in the terminal)

Used in the terminal color module chalk.

Install

Install locally with npm:

npm install --save strip-ansi

Or globally if you want to use it as a CLI app:

npm install --global strip-ansi

You can then use it in your Terminal like:

strip-ansi file-with-color-codes

Or pipe something to it:

ls | strip-ansi

Example

var stripAnsi = require('strip-ansi');
stripAnsi('\x1b[4mcake\x1b[0m');
//=> cake

License

MIT © Sindre Sorhus

Keywords

FAQs

Last updated on 08 Dec 2013

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