https://github.com/ivoputzer/m.noansi
m(icro)noansi is a lightweight es6+ library that removes ansi escape codes.
https://github.com/ivoputzer/m.noansi
ansi cli nodejs
Last synced: 3 months ago
JSON representation
m(icro)noansi is a lightweight es6+ library that removes ansi escape codes.
- Host: GitHub
- URL: https://github.com/ivoputzer/m.noansi
- Owner: ivoputzer
- Created: 2017-03-09T12:51:27.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-07-08T21:34:47.000Z (about 8 years ago)
- Last Synced: 2025-10-04T23:57:05.562Z (9 months ago)
- Topics: ansi, cli, nodejs
- Language: JavaScript
- Homepage:
- Size: 29.3 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
m.noansi
===
**[m(icro)](https://github.com/ivoputzer/m.cro#readme)[noansi](https://github.com/ivoputzer/m.noansi)** is a lightweight es6+ library that removes [ansi escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code).
[](https://travis-ci.org/ivoputzer/m.noansi)
[](package.json)
[](http://standardjs.com/)
[](https://coveralls.io/github/ivoputzer/m.noansi?branch=master)
[](https://nodejs.org/docs/v6.0.0/api)
[](https://www.npmjs.com/package/m.noansi)
[](https://www.npmjs.com/package/m.noansi)
[](https://spdx.org/licenses/MIT)
### stream replacement
the module itself exports a [transform](https://nodejs.org/api/stream.html#stream_class_stream_transform) [stream](https://nodejs.org/api/stream.html) that can be used according to its api.
```javascript
const noansi = require('m.noansi')
process.stdin.pipe(noansi).pipe(process.stdout)
```
### string replacement
the `noansi` method is used internally within the transform stream but can be used safely to replace string and buffers.
```javascript
const {noansi} = require('m.noansi')
noansi('\u001b[4mfoobar\u001b[0m') // => 'foobar'
```
### cli usage
when installed globally both `m.noansi` and `noansi` binaries are linked and can therefore be used:
```sh
npm --global install m.noansi
which noansi
echo "\u001b[4mfoobar\u001b[0m" | noansi # echo "foobar"
which m.noansi
echo "\u001b[4mfoobar\u001b[0m" | m.noansi # echo "foobar"
```