(path: Union[str, Path])
| 61 | |
| 62 | |
| 63 | async def read_bytes_async(path: Union[str, Path]) -> bytes: |
| 64 | try: |
| 65 | async with aiofiles.open(path, "rb") as f: |
| 66 | return await f.read() |
| 67 | except Exception as e: |
| 68 | logger.error(f"Failed to read bytes from {path}: {e}") |
| 69 | raise |
| 70 | |
| 71 | |
| 72 | async def write_bytes_async(path: Union[str, Path], data: bytes): |