Skip to content

chunk-process

Run N async tasks in parallel, then move on to the next batch. Built for API rate limits and resource control.
import { batchProcess } from 'chunk-process'
// Process 100 API calls, 5 at a time
const results = await batchProcess(userIds, async (userId) => {
return await fetchUserFromAPI(userId)
}, { batchSize: 5 })

Chunk-based rate limiting

Items in a batch run in parallel with Promise.all; batches run one after another, with an optional delay between them.

Retry & timeout

Retry failed tasks with linear or exponential backoff and cap each task with a timeout.

Error tolerant

With continueOnError, failed items are returned as Error values instead of rejecting the whole run.

Type-safe, zero dependencies

Written in TypeScript with generics and overloads. Ships ESM and CommonJS builds.