@jiminp/tooltool
    Preparing search index...

    Function fetchPages

    • Fetches pages as an async generator, yielding each non-null page with its index.

      Type Parameters

      • Page

        The type of data contained in a page

      Parameters

      Returns AsyncGenerator<{ index: number; page: NonNullable<Page> }>

      This is an async generator wrapper around forEachPage, providing a more functional approach to page iteration. Pages may be yielded out-of-order relative to their indices due to parallel fetching.

      Like forEachPage, this function fetches all pages in parallel with no concurrency limit. Consider rate-limiting the fetcher function.

      Objects containing the page data and its zero-based index

      If any fetch fails, the generator throws and terminates

      for await (const { page, index } of fetchPages(fetcher)) {
      console.log(`Page ${index}:`, page);
      }

      forEachPage for a callback-based alternative