Archive. Date of access: 12 Jan 2022

Marak Squires eec02f9359 [api] Box drawing is now optional 13 gadi atpakaļ
bin 3de4386096 [minor] Added ReadMe, reorganized demo names 13 gadi atpakaļ
lib eec02f9359 [api] Box drawing is now optional 13 gadi atpakaļ
templates 8afc7169c8 [api] Added wordwrap. Improving rendering. 13 gadi atpakaļ
.gitignore 7031b1ac8e [dist] First commit 13 gadi atpakaļ
ReadMe.md 6cb787830e [docs] Updating ReadMe 13 gadi atpakaļ
package.json 8afc7169c8 [api] Added wordwrap. Improving rendering. 13 gadi atpakaļ

ReadMe.md

ANSIdom v0.0.1

a quick and dirty DOM implementation in ANSI escape codes

share templates between the browser and the terminal

note: the current DOM implementation is a hack, at best. expect it to break, badly.

Live Demo

browser demo http://ohh.io/ANSIdom

terminal demo

 curl ohh.io/ANSIdom

these both share the same HTML template

Installation

 npm install ANSIdom

Usage

var ANSIdom = require('../lib/ANSIdom').ANSIdom,
    fs      = require('fs');

var dom = new ANSIdom();

var template = fs.readFileSync('./templates/index.html').toString();

dom.init(function(err){
  
  if (err) {
    throw err;
  }

  //
  // Note: `process` can be any streamable interface, like httpServer.response
  //
  dom.render(template, process);

});

Examples

see: /bin/ folder for some demos

MIT