This commit is contained in:
yumoqing 2025-09-23 13:38:39 +08:00
parent 3a4ef54399
commit 6d700279fe

View File

@ -187,13 +187,13 @@ async def downloadfile(url, headers=None, params=None, data={}):
fs = FileStorage()
fpath = fs._name2path(filename, userid='tmp')
try:
shc = StreamHttpClient()
async with aiofiles.open(fpath,'wb') as f:
shc = StreamHttpClient()
async for chunk in shc('GET', url,
headers=headers,
params=params,
data=data):
f.write(chunk)
await f.write(chunk)
return fpath
except Exception as e:
exception(f'save {url} to {fpath} exception:{e}')