AsyncparallelLimitparallelLimit CallableparallelLimit(maxConcurrency: number): <T>(task: () => T | Promise<T>) => Promise<T>Creates a limit function that allows you to schedule promises that execute with a maximum concurrency. Exampleconst limit = parallelLimit(2)const tasks = [ limit(async () => { await sleep(100) return 1 }), limit(() => 2), limit(() => 3),]await Promise.all(tasks)// => [1, 2, 3] Alternativesp-limitParametersmaxConcurrency: numberReturns <T>(task: () => T | Promise<T>) => Promise<T>A limit function.<T>(task: () => T | Promise<T>): Promise<T>Type parametersTParameterstask: () => T | Promise<T>Returns Promise<T>
Creates a limit function that allows you to schedule promises that execute with a maximum concurrency.
Example
Alternatives