4

I am using TDLib to implement my custom Telegram client in C#. When initializing the library, I have to set the folder for the telegram cache files and local databases. Whenever I download a photo with TdApi.DownloadFile, it is saved in that folder, presumably for caching.

Is it possible to disable this, and only receive the file in-memory, as either a Stream or a byte[]?

I understand the benefits of caching, but for security (and storage space) reasons that are specific to my application, I want to completely avoid any caching in the filesystem. I am wiling to sacrifice performance and loading speeds.

There are two possible solutions that I can think of. I could write code that automatically clears the download cache folders on app shutdown and startup, or I could somehow implement what the official desktop client does, and store the cached files in an encrypted format. The first solution is not very good when it comes to security, and I don't know how to implement the second one. So it would be best to just disable the caching.

Is this possible, and if so, how?

4

0 回答 0