https://github.com/simov/ansi-webkit
Print ANSI escaped colors in a browser console
https://github.com/simov/ansi-webkit
Last synced: about 1 year ago
JSON representation
Print ANSI escaped colors in a browser console
- Host: GitHub
- URL: https://github.com/simov/ansi-webkit
- Owner: simov
- License: mit
- Created: 2014-08-30T07:43:18.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2017-06-02T15:22:44.000Z (about 9 years ago)
- Last Synced: 2025-05-15T02:36:43.903Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ANSI-WebKit
## turns this
![ansi][1]
## into this
![webkit][2]
## how
```js
var aw = require('ansi-webkit');
var str = '[42m[31m[1mspawn[22m[39m[49m ';
console.log.apply(console, aw.parse(str));
```
## example
```js
// show the dev tools by default
require('nw.gui').Window.get().showDevTools().resizeTo(800, 1000);
var aw = require('ansi-webkit');
var spawn = require('child_process').spawn,
child = spawn('node', ['spawn.js']);
child.stdout.on('data', function (e) {
var str = e.toString().trim();
// ansi
console.log(str);
// parsed
console.log.apply(console, aw.parse(str));
});
child.stderr.on('data', function (e) {
var str = e.toString().trim();
console.log(str);
});
```
## license
MIT
[1]: http://i.imgur.com/gyPudQz.png
[2]: http://i.imgur.com/hZJxhID.png