How to make pyrogram download file faster?

131 Views Asked by At

I have a telegram bot that using pyrogram library. And when I downloading an document that user sent me, it is downloading it too slow. For examle file of 500MB it is downloading for near 5-6 minutes, but my server capabilities is:

Download: 291.83 Mbit/s Upload: 198.86 Mbit/s

Perhaps there is a way to use the full potential of the server to upload files as fast as possible

*My current code of downloading files:

downloaded_file = await bot.download_media(message, in_memory=True, progress=progress, progress_args=(uploading_message, interface_lang))

downloaded_file = bytes(downloaded_file.getbuffer())

I tried to download the file through the library requests using this link: https://api.telegram.org/file/bot{bot_token}/{file_path}, but so you can download files that do not exceed 20MB. And I need to download files of 500-600MB

0

There are 0 best solutions below