
Product
Introducing Supply Chain Attack Campaigns Tracking in the Socket Dashboard
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.
ratelimit-lru
Advanced tools
Small module for doing generic rate limiting using an LRU cache
npm install ratelimit-lru
var http = require('http')
var ratelimit = require('ratelimit-lru')
var ratelimited = ratelimit({
cache: 1000, // store up to 1000 in the cache
limit: 5 // 5 per second
})
var server = http.createServer(function (req, res) {
if (ratelimited(req.connection.address().host)) {
res.end('you are rate limited')
return
}
res.end('ok')
})
// try accessing this a bunch of times in your browser
server.listen(8080)
var ratelimited = ratelimit([opts])Returns a function that tells you if a current key (usually an IP string) is being ratelimited.
Options include:
{
cache: 1000, // how big the cache should be
limit: 5 // how many times per second this function can be called
}
var bool = ratelimited(key)Returns true if the key is being ratelimited, otherwise false.
MIT
FAQs
Small module for doing generic rate limiting using an LRU cache
We found that ratelimit-lru demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Campaign-level threat intelligence in Socket now shows when active supply chain attacks affect your repositories and packages.

Research
Malicious PyPI package sympy-dev targets SymPy users, a Python symbolic math library with 85 million monthly downloads.

Security News
Node.js 25.4.0 makes require(esm) stable, formalizing CommonJS and ESM compatibility across supported Node versions.