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

epsilon-delta

v0.3.4

Published

simple pluggable rate limiter middleware

Readme

epsilon-delta

by Elvin Yung

Circle CI

NPM

Quick, pluggable token-bucket rate limiter middleware for Express and Connect.

Quickstart

Install from NPM:

npm install epsilon-delta

Sample express app that uses epsilon-delta without redis (don't try this on production, kids!):

var epsilonDelta = require('epsilon-delta'),
  express = require('express');

var app = express();

var limiter = epsilonDelta({
  userKey: 'connection.remoteAddress', // identify users by IP
  capacity: 100, // 100 requests
  expire: 1000 * 60 * 60 * 1, // 1 hour
  limitResponse: {
    message: "Sorry! You're all out for now."
  }
});
app.use(limiter);

app.get('/', function (req, res) {
  res.status(200).send('Hello world!');
});

app.listen(3000);

Configurations

When creating a limiter, the following configurations are available:

db

The node-redis client to be used. If you don't provide one, epsilon-delta will use a rudimentary in-memory store.

userKey

The key used to identify individual users. By default this is the string connection.remoteAddress, the user's IP address.

You can also supply a function that takes a request parameter. If you do, epsilon-delta will call that function, passing in the request object, and use the return value as the user key.

capacity

The maximum number of requests in a user's bucket. By default, this is 200.

expire

The time in milliseconds, starting from the user's first request, before the user's token bucket is refilled. By default this is 3600000, or 1 hour.

limitResponse

The response body sent when the limit has been reached by the requesting user. This field can be either a string or an object, in which case it will be serialized to JSON.

limitCallback

A callback that will be called (with the request and response objects) when the limit has been reached by the requesting user. Note that if the callback sends a response, limitResponse won't be sent.

limitHeader

The name of the header that will contain the rate limit. Defaults to X-Rate-Limit-Limit.

remainingHeader

The name of the header that will contain the remaining request quota. Defaults to X-Rate-Limit-Remaining.

resetHeader

The name of the header that will contain the time left, in milliseconds, until the rate limiter resets. Defaults to X-Rate-Limit-Reset.

autolimit

A flag that determines if epsilon-delta should perform its own rate limiting responses. Defaults to true.

All configuration fields are optional.

Using the Limiter

The limiter returns a middleware function compatible with Express and Connect. In addition, the following methods are provided for a given limiter:

limiter.updateUser(userKey, callback)

Gets information regarding the limiter for the given userKey, passing it to callback.

limiter.rate(userKey, callback)

Determines whether the user can still make requests, passing it to callback. false means that the limit has been reached.

limiter.manualSet(userKey[, capacity, expire])

Sets the limiter numbers for the given userKey so that its bucket has the given capacity and it refills at expire.

limiter.manualSet(userKey, data)

Sets the limiter numbers for the given userKey according to data. data can contain capacity, a number representing the size of a bucket, and expire, a number representing the interval before the bucket is refilled.