Support async fd on download/upload (#1334)

This commit is contained in:
Lonami Exo
2019-12-27 12:04:08 +01:00
parent 5d7e9f3879
commit bdb74ac235
2 changed files with 13 additions and 2 deletions

View File

@@ -434,7 +434,10 @@ class DownloadMethods:
try:
async for chunk in self.iter_download(
input_location, request_size=part_size, dc_id=dc_id):
f.write(chunk)
r = f.write(chunk)
if inspect.isawaitable(r):
await r
if progress_callback:
r = progress_callback(f.tell(), file_size)
if inspect.isawaitable(r):