asyncfunctionbatch
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

AsyncFunctionBatch

This package lets you run a batch of async tasks in parallel, while limiting the number of concurrent tasks being run.

Installation

npm i --save asyncfunctionbatch

Usage

const {Job} = require("asyncfunctionbatch");

const array = ["hello", "world", "!"];
const concurrency = 10; // max number of tasks to run in parallel
const job = new Job(array, concurrency, async (item) => {
	// Run async task, `item` will be the specific array item.
});

await job.run(); // Will resolve after all tasks are done.

License

This package is licensed under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i asyncfunctionbatch

Weekly Downloads

7

Version

1.0.0

License

MIT

Unpacked Size

4.19 kB

Total Files

6

Last publish

Collaborators

  • fishcharlie