Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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) {
// ...
}
```