流式读取文件内容
()
| 1092 | url = self._build_url(safe_save_path) |
| 1093 | |
| 1094 | async def file_sender(): |
| 1095 | """流式读取文件内容""" |
| 1096 | chunk_size = 256 * 1024 # 256KB chunks |
| 1097 | while True: |
| 1098 | chunk = await asyncio.to_thread(file.file.read, chunk_size) |
| 1099 | if not chunk: |
| 1100 | break |
| 1101 | yield chunk |
| 1102 | |
| 1103 | async with aiohttp.ClientSession(auth=self.auth) as session: |
| 1104 | async with session.put( |