td icon indicating copy to clipboard operation
td copied to clipboard

How to disable saving files to disk? (use_file_database=false don't help)

Open a1ex33 opened this issue 1 year ago • 1 comments

We recently updated our tdlib from version 1.8.4 to 1.8.31. After this, session files (photos, videos, voices, etc.) began to be saved on the disk. We pass the setTdlibParameters command with the following params:

setTdlibParameters {
  use_test_dc = false
  database_directory = "/some_directory"
  files_directory = ""
  database_encryption_key = bytes [0] { }
  use_file_database = false
  use_chat_info_database = false
  use_message_database = false
  use_secret_chats = false
  api_id = 111
  api_hash = "our_hash"
  system_language_code = "en"
  device_model = "Compute Cloud"
  system_version = ""
  application_version = "1.0"
}

With these params on v1.8.4 everything worked fine. But after the update, files started saving to disk. What could be the reason?

a1ex33 avatar Aug 15 '24 11:08 a1ex33

There were no changes in TDLib behavior. Files are never downloaded automatically by TDLib, they can only be downloaded by your app. Some photos can always have their smallest size, which is received along with the photo and saved on the disk. These photos can be ignored by settings the option "ignore_inline_thumbnails" (see https://core.telegram.org/tdlib/options for details).

levlam avatar Aug 16 '24 17:08 levlam

Thanks for answering. After that I double checked our code and noticed that we use DownloadFile method in some cases, which downloads files. We added a periodic launch of optimizeStorage to clean up data.

a1ex33 avatar Sep 05 '24 11:09 a1ex33