Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@andste82/telnet-tty

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@andste82/telnet-tty

TTY interface for Telnet sessions

latest
Source
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

Telnet-TTY

A TTY-compatible Telnet interface for node.js

Telnet-TTY consists of the following functions:

  • a simple telnet server
  • a TTY interface for each telenet session

Each connection to the telnet server is mapped by an instance of the TelnetSession class. This class implements the node.js Duplex interface of the node:stream module. In addition, some necessary TTY functions have been added to comply with the node:tty interface.

Note: this module is still at a very early stage!

Examples

Readline interface

This example demonstrates how a telnet-tty session can be connected to the node:readline interface of node.js.

import { createInterface } from 'node:readline';
import { TelnetServer } from '@andste82/telnet-tty';

const server = new TelnetServer();

server.on('connection', (session) =>
{
  const rl = createInterface(
  {
    input: session,
    output: session,
    prompt: 'PROMPT> ',
  });

  rl.prompt();

  rl.on('line', (line) =>
  {
    switch (line.trim())
    {
      case 'hello':
        session.write('world!\n');
        break;

      default:
        session.write(`Say what? I might have heard '${line.trim()}'\n`);
        break;
    }
    rl.prompt();
  });

  rl.on('error', console.log);

  session.on('resize', () =>
  {
    console.log(session.getWindowSize());
  });
});

server.listen(23);

Keywords

Telnet

FAQs

Package last updated on 15 Jan 2025

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