@curiouser/rxjs-rate-limit
v0.1.0
Published
RxJS operator for complying with common rate limiting of x requests per y seconds
Downloads
9
Maintainers
Readme
RxJS Rate Limiter (mostly lossless)
- RxJS 7 pipeline operator
- Dead simple (40 lines)
- No dependencies
- Processes immediately, no delay to emissions
Beware
- No retries, that's up to you
- Currently only packaged for CommonJS. Open an issue if you'd like to consume an ESM.
Installation
npm add @curiouser/rxjs-rate-limit
Usage
const rateLimit = require('@curiouser/rxjs-rate-limit');
// 20 per second
someObservable.pipe(
rateLimit(20, 1000),
// do something that should be rate limited
);
Examples
See examples directory for examples you can run from CLI.