npm install vtTerminal.js is a rendering engine for vt100-like terminals.
It is written from scratch and supports most commonly used escape sequences.

- it can be used both in nodejs and as a javascript library in the browser
- it avoids any dependencies like pty, html outputting etc so you can provide your own
- it does not use an html dom to store it's state, this makes it server state compatible
- clean separation of different escape codes
- has a test framework
var TermWriter = require('terminal').TermWriter;
var TermBuffer = require('terminal').TermBuffer;
var buffer = new TermBuffer(80,24);
var terminal = new TermWriter(termBuffer);
terminal.write("first test\n");
// termWriter.buffer is accessible
var TermBuffer = require('terminal').TermBuffer;
var buffer = new TermBuffer(80,24);
buffer.inject("first test\n");
var TermDiff = require('terminal').TermDiff;
var TermBuffer = require('terminal').TermBuffer;
var buffer1 = new TermBuffer(80,24);
var buffer2 = new TermBuffer(80,24);
var terminal1 = new TermWriter(buffer1);
var terminal2 = new TermWriter(buffer2);
terminal1.write("test me");
var diff = new TermDiff(terminal1.buffer,terminal2.buffer);
diff.apply(terminal1);
- createChar
- createLine
- getLine
- write
- escapeWrite
- inject
- lineFeed
- mvCur : moves to relative coordinates
- setCur : move to absolute coordinates
- mvTab
- tabSet
- tabClear
- saveCursor
- restoreCursor
- deleteCharacters
- eraseCharacters
- setScrollRegion
- eraseInDisplay
- eraseInLine
- deleteLines
- resetAttr
- chAttr
- insertBlanks
- resize
- insertLines
- toString
- setLed
- scroll
- eventToKey
diff = {
changes: [
{ l: 0, '.': { // On line0 replace the line
str: 'test', // With string test
attr{
'0': { fg: null, bg:null, bold:false , underline: false, blink: false, inverse: false }, // Change Attributes on Pos0
'2': { fg: null, bg:null, bold:false , underline: false, blink: false, inverse: true } // Change Attributes on Pos2
}
},
{ l: 1, '+': { // Online 1 add a line
str: 'test', // With String test
attr{
'0': { fg: null, bg:null, bold:false , underline: false, blink: false, inverse: false }, // Change Attributes on Pos0
'2': { fg: null, bg:null, bold:false , underline: false, blink: false, inverse: true } // Change Attributes on Pos2
}
},
{ l: 2, '-': 3 }, // On line2 remove 3 lines
],
cursor: [ { from: { 'x': 0, 'y':10 }, to: { 'x': 0, 'y':12 } } ],
savedcursor: [ { from: { 'x': 0, 'y':10 }, to: { 'x': 0, 'y':12 } } ],
size: [ { from: { 'height': 80, 'width':24 }, to: { 'height': 30, 'width':12 } } ],
scrollregion: [ {from: [ 0, 10 ], to: [ 0, 12 ] } ],
modes: [ { 'graphic': true }, { 'insert': false } ],
tabs: [ { from: [] , to: [ 1 ] }]
}
- headless-terminal -
- tty.js -
- jquery terminal emulator -
- tty.js -
- screen-buffer -
- Terminal.js -
- terminal.js -
- Terminal.js -
- Js-terminal -
- ttycast.js -
- js.terminal -
- Node-terminal-shark -
- terminal.js is a dead simple JavaScript library for emulating a shell environment -
- terminal.js -
- JUIx -
- Termlib -
-
-
-
- we should clone the defaultBuffer instead of equalling it (see reset function)
- attrCommited? always after changr of attr?
- this.attr = this.defaultAttr (again it should copy it not equal the object)
- Termdiff.diff() - should it not be an array instead of a hash?