bodhi-async-batch
Version:
Run asynchronous tasks in batches with controlled concurrency - perfect for API calls, database operations, and file processing
14 lines (13 loc) • 522 B
TypeScript
interface AsyncBatchOptions {
concurrency?: number;
failFast?: boolean;
onProgress?: (completed: number, total: number) => void;
}
/**
* Executes an array of async tasks with controlled concurrency
* @param tasks Array of functions that return promises
* @param options Configuration options
* @returns Promise that resolves with array of results in the same order as input tasks
*/
export declare function asyncBatch<T>(tasks: (() => Promise<T>)[], options?: AsyncBatchOptions): Promise<T[]>;
export {};