Modules@robinpath/ratelimit
@robinpath/ratelimit
0.1.1PublicToken bucket and sliding window rate limiting for RobinPath
@robinpath/ratelimit
Rate limiting with token bucket, sliding window, and fixed window algorithms
Why use this module?
The ratelimit module lets you:
- Create a named rate limiter (token-bucket, sliding-window, or fixed-window)
- Try to acquire tokens/slots from a rate limiter
- Check if a request would be allowed without consuming a token
- Get the number of remaining tokens/slots
- Wait until a token is available, then acquire it
All functions are callable directly from RobinPath scripts with a simple, consistent API.
Installation
npm install @robinpath/ratelimit
Quick Start
No credentials needed — start using it right away:
ratelimit.acquire "api"
Available Functions
| Function | Description |
|---|---|
ratelimit.create | Create a named rate limiter (token-bucket, sliding-window, or fixed-window) |
ratelimit.acquire | Try to acquire tokens/slots from a rate limiter |
ratelimit.check | Check if a request would be allowed without consuming a token |
ratelimit.remaining | Get the number of remaining tokens/slots |
ratelimit.wait | Wait until a token is available, then acquire it |
ratelimit.reset | Reset a rate limiter to its initial state |
ratelimit.status | Get detailed status information for a rate limiter |
ratelimit.destroy | Remove a rate limiter and free its resources |
Examples
Try to acquire tokens/slots from a rate limiter
ratelimit.acquire "api"
Check if a request would be allowed without consuming a token
ratelimit.check "api"
Get the number of remaining tokens/slots
ratelimit.remaining "api"
Integration with RobinPath
import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/ratelimit";
const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);
const result = await rp.executeScript(`
ratelimit.acquire "api"
`);
Full API Reference
See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.
Related Modules
@robinpath/json— JSON module for complementary functionality
License
MIT
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.1 | latest | yesterday |
Related Modules
devops
0
@robinpath/bitbucket
v0.1.1robinpath
Bitbucket module for RobinPath.
0 downloads
...
devops
0
@robinpath/box
v0.1.1robinpath
Box module for RobinPath.
0 downloads
...
devops
0
@robinpath/cache
v0.1.1robinpath
In-memory key-value cache with optional TTL expiration for temporary data storage
0 downloads
...
devops
0
@robinpath/cloudflare
v0.1.1robinpath
Cloudflare module for RobinPath.
0 downloads
...
Install
$ robinpath install @robinpath/ratelimit Version0.1.1
LicenseMIT
Unpacked Size5.0 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

