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

hangman

v0.2.0

Published

Prevents hung Node.js processes

Readme

node-hangman

Tools like forever and PM2 are great for Node.js stability in production, but they're only effective at recovering processes that crash. They can't ensure the application is actually doing what it's supposed to do in a healthy state.

Hangman monitors a process from the inside and deliberately kills it when an unhealthy state is detected, letting the process manager kick in and restart it. Hangman is effective even in cases of a blocked event loop.

Healthy state can be monitored automatically as regular writes to stdout (which is typically how log files are written), or it can be specified in any context-specific way that would be appropriate for a particular app.

Usage

To kill a process if it is silent for over 60 seconds, all you need is:

require('hangman')();

You can specify a different timer interval:

// this process is expected to log something at least every 10s
require('hangman')(10000);

To reset the timer based on actions other than stdout writes, call the function that is returned when hangman is initiated:

var resetHangman = require('hangman')();

// execute this function whenever the process does what it's supposed to
server.on('request', function() {
	// respond to the request, then
	resetHangman();
});

To specify what happens when the timer expires, pass in a callback. Note that this will not be effective against starved event loop situations. Hangman does not continue monitoring after the callback has been called; it is up to you to initiate new instances.

require('hangman')(function() {
	console.log('All quiet on the western front.');
});

You can create multiple instances to monitor different things.

var hangman = require('hangman');
var stdoutMonitor = hangman();
var appMonitor = hangman(30000, function() {
	// note that using console.log here would actually trip the stdoutMonitor
	console.log('The app has not checked in for 30 seconds.')
});

A hangman monitor instance can be canceled and resumed.

var stdoutMonitor = require('hangman')();
stdoutMonitor.cancel();
stdoutMonitor.resume();

License

ISC