async-iterator-concurrent-map

Map over an iterator with a given concurrency

Usage no npm install needed!

<script type="module">
  import asyncIteratorConcurrentMap from 'https://cdn.skypack.dev/async-iterator-concurrent-map';
</script>

README

async-iterator-concurrent-map

Install

npm install async-iterator-concurrent-map
yarn add async-iterator-concurrent-map

Usage

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