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 🙏

© 2026 – Pkg Stats / Ryan Hefner

automesh

v1.2.1

Published

Automatically listen on random port and connect to other nodes on their random port

Readme

automesh

Automatically discover, connect to and accept TCP connections from other nodes on a subnet.

example

var m = require("automesh")();

m.on("inbound", function (remote) {
        remote.write("hello inbound connection\n");
        remote.pipe(process.stdout);
});

m.on("outbound", function (remote) {
        remote.write("hello outbound connection\n");
        process.stdin.pipe(remote).pipe(process.stdout);
});

install

npm install automesh

cli

npm install -g automesh

api

Constructor

var mesh = automesh([options]);
  • options is an optional configuration object
    • options.service - a service name provided by the mesh node. Example: '[email protected]' or 'geoip'
    • options.client - operate in client only mode. Disables outbound/server events (default: false)
    • options.server - operate in server only mode. Disables inbound/client events (default: flase)
    • options.port - discover port to use for UDP broadcast (passed to node-discover)
    • options.key - key used to encrypt broadcast traffic (passed to node-discover)
    • all other options are passed to the underlying node-discover constructor.

mesh.end()

Destroy all connections that have been established and stop discover services.

mesh.query([service])

  • service - optional - service name or servicename@semver to filter

This is a synchronous function that will return an array of services currently available. If no service is provided all services are returned.

mesh.register(service, type, connectionListener, readyListener)

  • service - service name or servicename@semver to register
  • type - the type of sevice. Used to tell the client how to process the stream
  • connectionListener - a callback function that is called for each new connection
  • readyListener - a callback function that is called when the service is registered and the stream is available.
var server = require('http').createServer(function (req, res) {
	res.end('hello');
});

mesh.register('[email protected]', null, null, function (err, service) {
	server.listen(service.server);
});

mesh.require(service, callback)

  • service - service name or servicename@semver to request
  • callback - function (err, remote, version)

Seaportish service registry callback. Get a callback when a mesh node appears on the network that provides a service that satisfies the semver portion of the service requirement. Callback is called again if remote closes and a matching service is available on another node.

Example Client:

var mesh = automesh({ client : true });

mesh.require('auth', function (err, remote, version) {

});

mesh.require('geoip@^1.0.0', function (err, remote, version ) {

});

Example Auth Server:

var mesh = automesh({ server : true, service : 'auth' });

mesh.on('client', function (remote) {
	//TODO: bind our auth functions via dnode to the remote stream
});

Example Geoip Server:

var mesh = automesh({ server : true, service : '[email protected]' })

mesh.on('client', function (remote) {
	//TODO: bind the geoip functions to the remote stream using dnode
});

events

inbound/client

Called when an inbound connection has been established from a remote client.

mesh.on('inbound', function (remote) {});
// or
mesh.on('client', function (remote) {});

outbound/server

Called when an outbound connection has been established to a remote server.

mesh.on('outbound', function (remote, node) {});
// or
mesh.on('server', function (remote, node) {});

local-service

Called when a local service has been created

var server = require('http').createServer(function (req, res) {
	res.end('hello');
});

mesh.on('local-service', function (service) {
	//tell the http server to listen using the newly
	//registered network stream
	server.listen(service.server);
});

cli

$ automesh list

inspiration

This started as an example on how to use node-discover for this conversation. For the purposes of that example, it may be best to review the code as of the initial commit. I have a problem keeping things simple so complexity has been introduced with new feature.

license

MIT