Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jpwilliams/rimiter

Simple in-memory rate limiter with banning
https://github.com/jpwilliams/rimiter

abuse ddos in-memory limit limiter memory rate rate-limiting spam

Last synced: 22 days ago
JSON representation

Simple in-memory rate limiter with banning

Awesome Lists containing this project

README

        

# Rimiter

``` js
// get package
const Rimiter = require('rimiter')

// create a new rate limiter
const rimiter = new Rimiter()

// when an item is rate limited, ban them for 60 seconds
rimiter.on('limited', rimiter.ban)

// limited is whether 'user-1' is now rate limited
const limited = rimiter.limit('user-1')
```

---

## Events

* `limited` - ID that has just been limited
* `banned` - ID that has just been banned
* `unbanned` - ID that has just been unbanned