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

ecco

v0.7.0

Published

A streaming netcat clone for Node.js

Downloads

5

Readme

Ecco - a netcat type clone for Node.js

Ecco is the result of my search for a netcat clone that worked with node.js as a requireable module and via a CLI counterpart. I couldn't locate one, so I humbly present Ecco.

It aims to have feature parity with the popular netcat-openbsd program. It's not quite there yet, but it works great as a TCP echo server right now, and it uses node.js' streaming interfaces under the hood.

The primary advantage of Ecco over netcat lies in its ability to concurrently handle simultaneous without forking an expensive sub process each time.

Install

npm install -g ecco

CLI Usage

ecco -h

Usage:
-------
Client: $ ecco <PORT>
Client: $ ecco --address 10.0.0.1 <PORT>

Server: $ ecco -l <PORT>
Server: $ ecco -l --address 0.0.0.0 --out-file /tmp/ecco-recv.txt <PORT>

-h                       This help screen
-l / --listen                 Start a listening server
-p / --port <PORT>   The server port
-q / --quiet                   Supress output
-v / --verbose               Increase output verbosity
--address <HOST>       The address to serve or connect upon
--disable-stdout       Supress logging of ingress/egress data to stdout
--echo                           If in listen mode, echo back received data to the client
--timeout <TIMEOUT>    Sets the idle socket timeout on server/client connections (ms)
--version                 Prints the version and exits
--out-file <FILE PATH> If in listen mode, write all received data to this file

As another example,you can send things to stdin and the client will stream it to the server:

$ ecco -l --out-file /data/backup/file.txt 9000

$ cat file.txt | ecco --address backup-server.com 9000

And here's a simple TCP echo server with a one minute connection timeout:

$ ecco -l --echo --timeout 60000 9000

Module usage

Server

var Ecco = require('ecco');

var server = new Ecco( { port: 3000, echo: true } ).Server();

server.on('error', function(e){
    console.log(e);
});

server.on('client-error', function(e){
    console.error(e);
});

server.on('client-timeout', function(client_sock){
    console.log('Client timed out:', client_sock.remoteAddress)
});

server.start(function(){
    console.log('server is listening on port:', server.opts.port);
});

Client

var client = new Ecco( { port: 3000 } ).Client();

client.on('connected', function(){
    client.conn.write(data);
})

client.on('error', function(e){
    console.error(e);
})

client.start()

Also see the tests/* files for more involved usage with other arguments.

TODO

If you want to take a shot at any of these, I would be happy to accept a PR.

  • IPv6
  • UDP protocol support
  • run system binary command on each new connection
  • multiple port ranges in client mode (a.k.a port scanner)