A token bucket rate limiter for Deno.
- Simple and easy to use.
- Rate limiting based on token bucket algorithm.
For Deno:
$ deno add @117/throttle
import { createThrottle } from "@117/throttle";
const throttle = createThrottle({ limit: 5, interval: 1000 });
const work = async () => {
await throttle.wait();
console.log("request allowed, processing work");
};
setInterval(work, 200);
Feel free to contribute and PR to your 💖's content.