Interface FileDownloadParameters

interface FileDownloadParameters {
    abortSignal?: AbortSignal;
    dcId?: number;
    fileSize?: number;
    limit?: number;
    offset?: number;
    partSize?: number;
    progressCallback?: ((downloaded: number, total: number) => void);
}

Properties

abortSignal?: AbortSignal

Abort signal that can be used to cancel the download.

dcId?: number

DC id from which the file will be downloaded.

If provided DC is not the one storing the file, redirection will be handled automatically.

fileSize?: number

Total file size, if known. Used to determine upload part size. In some cases can be inferred from file automatically.

limit?: number

Number of bytes to be downloaded. By default, downloads the entire file

offset?: number

Offset in bytes. Must be divisible by 4096 (4 KB).

partSize?: number

Download part size (in KB). By default, automatically selected depending on the file size (or 64, if not provided). Must not be bigger than 512, must not be a fraction, and must be divisible by 4.

progressCallback?: ((downloaded: number, total: number) => void)

Function that will be called after some part has been downloaded.

Type declaration

    • (downloaded, total): void
    • Parameters

      • downloaded: number
      • total: number

        Total file size (Infinity if not available)

      Returns void