(self, file, save_path)
| 112 | self.root_path = data_root |
| 113 | |
| 114 | def _save(self, file, save_path): |
| 115 | with open(save_path, "wb") as f: |
| 116 | chunk = file.read(self.chunk_size) |
| 117 | while chunk: |
| 118 | f.write(chunk) |
| 119 | chunk = file.read(self.chunk_size) |
| 120 | |
| 121 | async def save_file(self, file: UploadFile, save_path: str): |
| 122 | path_obj = Path(save_path) |