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

psycho-proxy

v0.1.2

Published

Crazy way to proxy data

Readme

psycho-proxy

Because you'd have to be nuts to use this.

It's a little experiment I did to see how quickly Node could proxy data when all the fluff layers are removed.

Warning: This only works with, I think, v0.11.5 and above.

API

Here's a basic overview of this very basic API. First, though, here's some basic usage:

var Proxy = require('psycho-proxy');
// Pass the listening port on instantiation.
var p = new Proxy(8081);

p.onalert(function(err) {
  // Alerts are things that are nice to know,
  // but won't break the world.
});

p.onerror(function(err) {
  // These could cause your application to crash,
  // but if handled return "true" to continue normally.
});

// First pass the expected Host then where it should go.
p.add('localhost:8081', 8080);

Proxy(pOp)

Create a new Proxy instance, passing in the port or path (pOp). This is a custom object built on top of Node internals. So don't expect a Stream back or anything.

Proxy.setMaxHeaderLength(n)

  • n Number: Number of bytes to inspect.

Set how much data to read, looking for the Host header, before the connection is closed. This is to prevent flooding.

Proxy#add(host, pOp)

  • host String: Expected Host header.
  • pOp Number|String: Port or path to proxy data.

Proxy#onalert(callback[, remove])

  • callback Function: Callback called when an alert is issued. The same callback can be added only once.
  • remove Boolean: Pass true if you wish to remove the given callback.

The onalert() callback will receive an Error instance as its only argument. The following additional properties may be set on this object:

  • handle Object: The object instance on which the alert occurred.
  • code String: The alert code for what happened (I made up some of these).
  • data Buffer: All the data that has been collected by the given connection.
  • host String: The Host field that was parsed from the request.

Proxy#onerror(callback[, remove])

  • callback Function: Callback called when an error is issued. The same callback can be added only once. User can optionally return true if the error has been handled.
  • remove Boolean: Pass true if you wish to remove the given callback.

Errors from Proxy are when something out of the control of Proxy has happened. For example, if an incoming request needs to connect to a remote location and was unable to do so. If the user can recover from any of these errors then simply return true from the callback and execution will continue as normal (at least in theory).

The Error object passed to the onerror() callback will have the following additional property set:

  • handle Object: The object instance on which the error occurred.

TBD (to be done)

Currently there isn't proper support for IPv6, and several other methods are missing. Like the ability to close specific connections based on user specified criterion.