Documentation - v0.27.4
    Preparing search index...

    Function downloadAsIterable

    • Download a file and return it as an iterable, which yields file contents in chunks of a given size. Order of the chunks is guaranteed to be consecutive.

      Parameters

      • client: ITelegramClient
      • input: FileDownloadLocation
      • Optionalparams: FileDownloadParameters & {
            throttle?: (chunkSize: number) => MaybePromise<void>;
        }

        Download parameters

        • Optionalthrottle?: (chunkSize: number) => MaybePromise<void>

          A function to apply backpressure to the download.

          If the consumer isn't keeping up, the function is supposed to return a promise that resolves when the consumer is ready to receive more data.

          Note that this function will likely get called multiple times simultaneously, since the download is parallelized.

      Returns AsyncIterableIterator<Uint8Array<ArrayBufferLike>>