New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@join-com/request-limit

Package Overview
Dependencies
Maintainers
6
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@join-com/request-limit

Limits number of function call per time frame

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
1
-75%
Maintainers
6
Weekly downloads
 
Created
Source

request-limit

Limits number of executed requests made per time frame

Usage

import { RequestLimit } from '@join-com/request-limit'

const REQUESTS_LIMIT = 5 // Max number of requests can be executed during specific time frame
const REQUESTS_LIMIT_TIMEOUT = 10000 // Time frame in ms for which number of requests can be executed is limited
const RETRY_TIMEOUT = 1000 // Timeout in ms after which not executed requests will be re-scheduled

// Create an instance
const requestLimit = new RequestLimit(REQUESTS_LIMIT, REQUESTS_LIMIT_TIMEOUT, RETRY_TIMEOUT)

// Function will be limited to 5 requests per 10 seconds
const request = requestLimit.setLimit(
  () => { // Do something }
)

Keywords

request

FAQs

Package last updated on 19 Dec 2018

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