Skip to content

Latest commit

 

History

History
45 lines (29 loc) · 877 Bytes

README.md

File metadata and controls

45 lines (29 loc) · 877 Bytes

throttle

version status

A token bucket rate limiter for Deno.

Contents

Features

  • Simple and easy to use.
  • Rate limiting based on token bucket algorithm.

Install

For Deno:

$ deno add @117/throttle

Example

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);

Contributing

Feel free to contribute and PR to your 💖's content.