@capgo/cli
Version:
A CLI to upload to capgo servers
14 lines (13 loc) • 777 B
TypeScript
/** CPU-bound work (Brotli, AES, SHA-256) gains nothing past the core count. */
export declare function defaultCpuConcurrency(max?: number): number;
/**
* Runs `task` for every index in [0, count) with at most `concurrency` tasks in
* flight. A worker picks the next index as soon as it is free, so one slow task
* never holds back the others (unlike fixed `Promise.all` batches).
*
* The first failure stops new tasks from starting. The returned promise rejects
* with that first error only once every running task has settled, so caller
* cleanup (e.g. disposing the delta payload cache) never races a task that is
* still in flight.
*/
export declare function runWorkerPool<T>(count: number, concurrency: number, task: (index: number) => Promise<T>): Promise<T[]>;