🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

async-limiter

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-limiter

asynchronous function queue with adjustable concurrency

2.0.0
latest
Source
npm
Version published
Weekly downloads
8.9M
-8.83%
Maintainers
1
Weekly downloads
 
Created

What is async-limiter?

The async-limiter package is a module that allows you to limit the number of asynchronous operations that are being processed at the same time. This is useful for controlling resource usage and managing load under high-concurrency situations.

What are async-limiter's main functionalities?

Concurrency Limiting

This code sample demonstrates how to use async-limiter to limit the number of concurrent asynchronous tasks. In this example, the concurrency limit is set to 2, meaning only two tasks will be processed at a time.

const Limiter = require('async-limiter');

const t = new Limiter({ concurrency: 2 });

for (let i = 0; i < 10; i++) {
  t.push((cb) => {
    setTimeout(() => {
      console.log('Processed task', i);
      cb();
    }, 100);
  });
}

t.onDone(() => {
  console.log('All tasks processed');
});

Other packages similar to async-limiter

Keywords

throttle

FAQs

Package last updated on 20 Nov 2019

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