🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

@spacejunk/ftl

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@spacejunk/ftl

Rate limiter for outgoing Axios requests, so you don't violate the speed of light!

latest
Source
npmnpm
Version
1.2.1
Version published
Weekly downloads
28
75%
Maintainers
1
Weekly downloads
 
Created
Source

@spacejunk/ftl 🚀

🚧 This project is currently still a work in progress Welcome to @spacejunk/ftl! Having trouble navigating the galaxy of rate limits and bursts while making API requests? FTL (Faster-Than-Light) is here to help. This package is designed to manage and streamline your Axios requests, ensuring they adhere to the rate limits and burst restrictions set by your API provider.

Features:

  • 🌌 Manage rate-limited and burst-limited requests effortlessly
  • 🪐 Automatic request queuing and execution
  • 🛸 Built-in rate limit and burst tracking
  • 📡 Exportable request logs for debugging and analysis (🚧 under development)

Installation

Install @spacejunk/ftl and axios using npm or yarn:

npm install @spacejunk/ftl axios

or

yarn add @spacejunk/ftl axios

Usage

To start using @spacejunk/ftl, follow the example below and customize the configuration to suit your needs. With the provided instance, you can make API requests as you normally would.

import FTL from '@spacejunk/ftl';
import axios from 'axios';

const axiosInstance = axios.create({ baseURL: 'https://api.example.com' });

const ftl = new FTL({
  maxRequestsPerSecond: 10, // the maximum number of requests per second
  burstRequests: 5, // the number of burst requests allowed
  burstTime: 1, // the time window for burst requests (in seconds)
  instance: axiosInstance, // your axios instance
});

const api = ftl.getInstance();

// Now you can make your API requests as usual with your axios instance
api.get('/endpoint').then((response) => {
  console.log(response.data);
});

Contributing

We appreciate all fellow space travelers who want to contribute! If you have any suggestions, bug reports, or feature requests, feel free to open an issue or submit a pull request. Let's make @spacejunk/ftl even better together! 🤝

Keywords

spacetraders

FAQs

Package last updated on 29 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts