Strip ANSI escape codes from a string
open sourceMITfree
strip-ansi removes ANSI escape codes (colours, styles, and OSC hyperlinks) from a string in JavaScript. Node.js now has util.stripVTControlCharacters built in; this package gives consistent behaviour across Node.js versions and environments. It's from the Chalk project, with a CLI (strip-ansi-cli) and a streaming version alongside.
Problems it solves
- remove terminal colour codes from a string in Node.js
- clean ANSI escape codes from CLI output before logging
- get plain text from colourised terminal output
Features
- removes ANSI colour and style codes
- removes OSC hyperlink sequences
- consistent across Node.js versions
Alternatives
The same job
These do what strip-ansi does.
