Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trs/async-iterator-concurrent-map
Map over an iterator with a given concurrency
https://github.com/trs/async-iterator-concurrent-map
Last synced: 23 days ago
JSON representation
Map over an iterator with a given concurrency
- Host: GitHub
- URL: https://github.com/trs/async-iterator-concurrent-map
- Owner: trs
- Created: 2021-02-16T04:14:12.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-02-16T04:22:20.000Z (almost 4 years ago)
- Last Synced: 2024-12-12T00:44:23.330Z (27 days ago)
- Language: TypeScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# async-iterator-concurrent-map
## Install
```
npm install async-iterator-concurrent-map
``````
yarn add async-iterator-concurrent-map
```## Usage
```ts
import { mapConcurrent } from 'async-iterator-concurrent-map';const concurrentIterator = mapConcurrent(someAsyncGenerator, 10, async (value) => {
const result = await someIO(value); // Up to 10 of these will run concurrently
return result;
});for await (const value of concurrentIterator) {
// ...
}
```