common-stuff
    Preparing search index...

    Function pLimit

    • Returns a wrapper that runs at most concurrency async tasks at a time.

      Tasks queue up beyond the limit. The wrapper returns the same value/rejection the underlying task does, so it composes naturally with Promise.all.

      Parameters

      • concurrency: number

      Returns <T>(fn: () => Promise<T>) => Promise<T>

      const limit = pLimit(2)
      await Promise.all(urls.map(u => limit(() => fetch(u))))