upload: deel 01
This commit is contained in:
@@ -140,6 +140,18 @@ class FilesystemAdapter:
|
||||
"modified": self.modified_iso(path),
|
||||
}
|
||||
|
||||
def write_uploaded_file(self, path: Path, file_stream, chunk_size: int = 1024 * 1024) -> dict:
|
||||
with path.open("xb") as handle:
|
||||
while True:
|
||||
chunk = file_stream.read(chunk_size)
|
||||
if not chunk:
|
||||
break
|
||||
handle.write(chunk)
|
||||
return {
|
||||
"size": int(path.stat().st_size),
|
||||
"modified": self.modified_iso(path),
|
||||
}
|
||||
|
||||
async def stream_file_range(self, path: Path, start: int, end: int, chunk_size: int = 1024 * 1024):
|
||||
with path.open("rb") as handle:
|
||||
handle.seek(start)
|
||||
|
||||
Reference in New Issue
Block a user