Gathering detailed insights and metrics for api-rate-limiter-sdk
Gathering detailed insights and metrics for api-rate-limiter-sdk
npm install api-rate-limiter-sdk
Typescript
Module System
Node Version
NPM Version
70.6
Supply Chain
89.1
Quality
77.3
Maintenance
50
Vulnerability
99.6
License
Total Downloads
246
Last Day
1
Last Week
8
Last Month
20
Last Year
246
Minified
Minified + Gzipped
Latest Version
0.0.2
Package Id
api-rate-limiter-sdk@0.0.2
Unpacked Size
17.37 kB
Size
3.95 kB
File Count
18
NPM Version
10.4.0
Node Version
21.6.0
Publised On
25 Aug 2024
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
100%
8
Compared to previous week
Last month
400%
20
Compared to previous month
Last year
0%
246
Compared to previous year
6
A TypeScript library for API rate limiting with support for leaky bucket and token bucket algorithms. This package helps manage API request rates, implement retries, and apply backoff strategies.
To install the package, use npm:
1npm install api-rate-limiter-sdk
Or with yarn:
yarn add api-rate-limiter-sdk
Leaky Bucket:
import { LeakyBucket } from 'api-rate-limiter-sdk';
const bucket = new LeakyBucket({
capacity: 10, // Maximum number of requests
leakRate: 1 // Leak rate per second
});
bucket.addRequest()
.then(() => console.log('Request processed'))
.catch((err) => console.error('Request rate limited:', err));
import { TokenBucket } from 'api-rate-limiter-sdk';
const bucket = new TokenBucket({
capacity: 10, // Maximum number of tokens
refillRate: 1 // Tokens added per second
});
bucket.addRequest()
.then(() => console.log('Request processed'))
.catch((err) => console.error('Request rate limited:', err));
capacity
: The maximum number of requests or tokens allowed.leakRate
(Leaky Bucket): The rate at which requests are processed.refillRate
(Token Bucket): The rate at which tokens are added to the bucket.To run the tests for this package, use:
npm test
No vulnerabilities found.
No security vulnerabilities found.