https://github.com/rrainn/asyncfunctionbatch
https://github.com/rrainn/asyncfunctionbatch
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rrainn/asyncfunctionbatch
- Owner: rrainn
- License: mit
- Created: 2021-12-19T03:20:15.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-19T03:27:13.000Z (over 3 years ago)
- Last Synced: 2025-03-28T05:28:53.252Z (4 months ago)
- Language: TypeScript
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AsyncFunctionBatch
This package lets you run a batch of async tasks in parallel, while limiting the number of concurrent tasks being run.
## Installation
```bash
npm i --save asyncfunctionbatch
```## Usage
```js
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.