Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 8, 2024 via pnpm

limiter 1.1.5

A generic rate limiter for node.js. Useful for API clients, web crawling, or other tasks that need to be throttled
Package summary
Share
0
issues
1
license
1
MIT
Package created
17 Apr 2012
Version published
8 Jan 2020
Maintainers
1
Total deps
1
Direct deps
0
License
UNKNOWN

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
limiter@1.1.5
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of limiter 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does limiter do?

Limiter is a generic rate limiter for the web and node.js. It's useful in various scenarios such as when you're working with API clients, involved in web crawling, or undertaking any tasks that demand throttling. Two classes, RateLimiter and TokenBucket, are exposed by Limiter. TokenBucket offers a granular interface for rate limiting with an adjustable burst rate and drip rate, while RateLimiter builds on top of the token bucket and introduces a restriction on the maximum number of tokens that can be withdrawn each interval to conform with common API limitations.

How do you use limiter?

To use Limiter, you first need to install it via yarn or npm:

yarn install limiter

Then you can import and use it in your application. A simple usage example where 150 requests per hour are allowed would look like this:

import { RateLimiter } from "limiter";

const limiter = new RateLimiter({ tokensPerInterval: 150, interval: "hour" });

async function sendRequest() {
  const remainingRequests = await limiter.removeTokens(1);
  callMyRequestSendingFunction(...);
}

Another usage example where one message can be sent every 250ms would look like this:

import { RateLimiter } from "limiter";

const limiter = new RateLimiter({ tokensPerInterval: 1, interval: 250 });

async function sendMessage() {
  const remainingMessages = await limiter.removeTokens(1);
  callMyMessageSendingFunction(...);
}

Where are the limiter docs?

The official Limiter documentation is available within its GitHub repository (git://github.com/jhurliman/node-rate-limiter.git). Additionally, the documentation can be found within the README file on the package's npm page. It includes detailed installation and usage instructions, along with several code examples.