Skip to content

eirikb/telnet.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 

Repository files navigation

telnet.js

Library to generate output for a telnet server

Note that this is not a telnet client or telnet server, its a library that will create strings a server can use to reply to clients.
require('net') to create a server.

Demo

Try it:

telnet eirikb.no

Install

npm install telnet

Example

var net = require('net'),
telnet = require('telnet.js');

net.createServer(function(c) {
    telnet.cmd().IAC.WILL.echo.IAC.WILL.suppressGoAhead.send(c);
    telnet.seq().move(2, 8).bold.underline.a('Hello world').send(c);

    c.on('data', function(buffer) {
        console.log(buffer);
    });
}).listen(7000);

API

Escape sequences

reverseVideo - Set reverse video on screen
normalVideo - Set normal video on screen
normal - Turn off character attributes
bold - Turn bold mode on
underline - Turn underline mode on
reverse - Turn reverse video on
red - Turn red color one
green - Turn green color one
yellow - Turn yellow color one
purple - Turn purple color one
pink - Turn pink color one
cyan - Turn cyan color one
white - Turn white color one
move - Move cursor to screen location v,h
clear - Clear entire screen
up - Move cursor up n lines
down - Move cursor down n lines
right - Move cursor right n lines
left - Move cursor left n lines
home - Move cursor to upper left corner
scrollUp - Move/scroll window up one line
scrollDown - Move/scroll window down one line
nextline - Move to next line
save - Save cursor position and attributes
restore - Restore cursor position and attributes
bigTop - Double-height letters, top half
bigBottom - Double-height letters, bottom half
singleWidth - Single width, single height letters
doubleWidth - Double width, single height letters
clearRight - Clear line from cursor right
clearUp - Clear line from cursor left
clearLine - Clear entire line
clearDown - Clear screen from cursor down
clearUp - Clear screen from cursor up
reset - Reset terminal to initial state

About

Node telnet library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published