npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

teletype

v0.2.0

Published

A simple Telnet client.

Downloads

72

Readme

Teletype

Node.js package Build status

A simple Telnet client.

Installation

$ npm install teletype --save

Usage

const teletype = require('teletype')
const client = teletype('localhost')

client.exec('?PWR', /PWR[01]/)
  .then(response => {
    console.log(response) // PWR0
  })

API

teletype(host[, port, options])

Creates a Teletype client.

host

Type: String

The hostname or IP address of the host to connect to.

port

Type: Number
Default: 23

The port to connect to.

options

Type: Object

timeout

Type: Number or false
Default: false

The number of milliseconds before a call is considered to be timed out. This applies to the initial connection, readUntil(), and exec() if called with match. exec() without match and close() will never time out.

client.exec(command[, match])

Sends a command to the host and reads incoming data until match is encountered. If match is given, it returns a promise for a response string which contains the first line where match was encountered.

command

Type: String

The command to send to the host.

match

Type: RegExp

The regular expression to match against incoming data. If omitted, Teletype won’t read any incoming data but will send the command to the host.

client.readUntil(match)

Reads incoming data from the host until match is encountered. Returns a promise for a response string which contains the first line where match was encountered.

client.close()

Sends a FIN packet and destroys the socket.

Errors

If a required argument is missing, Teletype will reject a TypeError. If a call times out, it will reject an error with the code ETIMEDOUT. Any other error will be the same as emitted by Node.js’s net.

Acknowledgments

Teletype is inspired by Ruby’s Net::Telnet and Python’s telnetlib.

If you need something more advanced, take a look at telnet-client.

License

Teletype itself is licensed under the ISC license. See LICENSE for the full license.