Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 14, 2025. It is now read-only.

downloadFile

Sahri Riza Umami edited this page Jul 1, 2018 · 4 revisions

Asynchronously downloads a file from the cloud.
updateFile will be used to notify about the download progress and successful completion of the download.
Returns file state just after the download has been started.

downloadFile(file_id, priority, callback, data)
Field Type Description
file_id int32 Identifier of the file to download.
priority int32 Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile was called will be downloaded first.

Example

  • Asynchronously downloads file 12 from cloud uses the highest priority.

    downloadFile(12, 32)

    Response:

    {
      ["@type"] = "file",
      expected_size = 1027,
      id = 12,
      ["local"] = {
        ["@type"] = "localFile",
        can_be_deleted = true,
        can_be_downloaded = true,
        downloaded_prefix_size = 1027,
        downloaded_size = 1027,
        is_downloading_active = false,
        is_downloading_completed = true,
        path = "/home/iza/.config/.telegram-bot/files/documents/default.prop"
      },
      remote = {
        ["@type"] = "remoteFile",
        id = "BQADBQADMwADZ6iIVM_BOoMFwLWBAg",
        is_uploading_active = false,
        is_uploading_completed = true,
        uploaded_size = 1027
      },
      size = 1027
    }

Frequently Asked Questions
The Functions

Clone this wiki locally