Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rrainn/asyncfunctionbatch
https://github.com/rrainn/asyncfunctionbatch
Last synced: 23 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/rrainn/asyncfunctionbatch
- Owner: rrainn
- License: mit
- Created: 2021-12-19T03:20:15.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-19T03:27:13.000Z (about 3 years ago)
- Last Synced: 2024-12-09T16:55:54.481Z (30 days 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.