/strip-ansi-stream

Strip ANSI escape codes

Primary LanguageJavaScriptMIT LicenseMIT

strip-ansi-stream

Strip ANSI escape codes

Install

$ npm install strip-ansi-stream

Usage

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');

API

stripAnsiStream()

Returns a Transform stream that strips ANSI escape codes.

Related

  • 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