it-parallel-batch
Takes an async iterator that emits promise-returning functions, invokes them in parallel and emits the results as they become available but in the same order as the input
The final batch may be smaller than the batch size.
Install
$ npm install --save it-parallel-batch
Usage
const batch = require('it-parallel-batch')
const all = require('it-all')
const delay = require('delay')
const input = [
async () => {
await delay(500)
return 1
},
async () => {
await delay(200)
return 2
},
async () => {
await delay(100)
return 3
}
]
const batchSize = 2
const result = await all(parallelBatch(input, batchSize))
console.info(result)