✨ Added new tests and fixed small bugs
This commit is contained in:
@@ -12,11 +12,6 @@ import aiofiles.os
|
||||
_DEFAULT_CHUNK_SIZE = 32768 # bytes; arbitrary
|
||||
|
||||
|
||||
async def aioshutil_copyfileobj(async_fsrc, async_fdst, *, chunksize: int = _DEFAULT_CHUNK_SIZE) -> None:
|
||||
while (chunk := await async_fsrc.read(chunksize)) != b"":
|
||||
await async_fdst.write(chunk)
|
||||
|
||||
|
||||
class LocalStorage:
|
||||
def __init__(self, base_path: str):
|
||||
self.base_path = base_path
|
||||
|
||||
@@ -134,8 +134,9 @@ class S3Storage:
|
||||
)
|
||||
|
||||
def size(self, file_name: str) -> int | None:
|
||||
res = self.client.stat_object(bucket_name=self.bucket_name, object_name=file_name)
|
||||
if res is None:
|
||||
try:
|
||||
res = self.client.stat_object(bucket_name=self.bucket_name, object_name=file_name)
|
||||
except minio.error.S3Error:
|
||||
return None
|
||||
return res.size
|
||||
|
||||
|
||||
Reference in New Issue
Block a user