A lightweight request rate-limiter for axios implementing a leaky-bucket algorithm. Current version 0.2.0 (updated 2024) requires axios as a peer dependency (1.x). Differentiators: extremely small (37 lines), TypeScript-first, no runtime dependencies beyond axios. Allows throttling via requests per second (rps) or requests per minute (rpm) with a simple API. Works by adding an axios request interceptor. Maintained but still early stage.
npm install axios-throttlerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates axios client, throttles to max 5 requests per second, then issues 5 concurrent requests.
Ensure axios is installed: npm install axios
Upgrade to 0.2.0: npm install axios-throttler@latest
Always create a client with axios.create() before throttling.
Apply throttle after setting up all interceptors, or reapply them.
Apply throttle separately for each axios client instance.
Install the package: npm install axios-throttler. Also ensure tsconfig.json has 'moduleResolution': 'node' or 'node16'.
Import { AxiosThrottler } from 'axios-throttler' (named import, not default).Use static methods directly: AxiosThrottler.throttle(client, options) without new.
Use AxiosThrottler.rps(5) or AxiosThrottler.rpm(100).