Strip ANSI escape codes
$ npm install strip-ansi-stream
import stripAnsiStream from 'strip-ansi-stream';
const stream = stripAnsiStream();
stream.on('data', data => {
console.log(data);
//=> 'Unicorn'
//=> 'bar'
})
stream.write('\u001B[4mUnicorn\u001B[0m');
stream.end('\u001B[0;33;49;3;9;4mbar\u001B[0m');
Returns a Transform
stream that strips ANSI escape codes.
- strip-ansi - Non-streaming version of this module
- has-ansi - Check if a string has ANSI escape codes
- ansi-regex - Regular expression for matching ANSI escape codes
- chalk - Terminal string styling done right