Skip to content

RxJS operator for complying with common rate limiting of x requests per y seconds

Notifications You must be signed in to change notification settings

curiousercreative/rxjs-rate-limit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

RxJS operator for complying with common rate limiting of x requests per y seconds

Resources

Stars

Watchers

Forks

Packages

No packages published