Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ansi-html-stream

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansi-html-stream

Stream ANSI terminal output to an HTML format.

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.4K
decreased by-31.4%
Maintainers
1
Weekly downloads
 
Created
Source

ansi-html-stream Build Status

A through-stream that converts terminal output to HTML.

Installation

$ npm install ansi-html-stream

Or, if you want to install the CLI tool:

$ [sudo] npm install -g ansi-html-stream

Usage

Take this example to pipe a log of NPM's install command to an HTML file:

$ npm install browserify --color always 2&>1 | ansi-html > browserify.html

And an equivalent from Node:

var spawn = require('child_process').spawn
  , ansi = require('ansi-html-stream')
  , fs = require('fs')

var npm = spawn('npm', ['install', 'browserify', '--color', 'always'], {
    cwd: process.cwd()
})

var stream = ansi({ chunked: false })
  , file = fs.createWriteStream('browserify.html', 'utf8')

npm.stdout.pipe(stream)
npm.stderr.pipe(stream)

stream.pipe(file, { end: false })

stream.once('end', function() {
  file.end('</pre>\n')
})

file.write('<pre>\n');

There are a few options you can pass to the stream too:

  • classes: Use classes instead of inline styles for formatting.
  • theme: Override the styling for particular ANSI codes. See colors.js for two examples.
  • chunked: Ensure that each chunk's elements are self-contained - closes any open <span>s at the end and reopens them on the next chunk. Defaults to false.

Keywords

FAQs

Package last updated on 29 Jan 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc