Spaces:
Sleeping
Sleeping
| def humanbytes(size): | |
| if not size: | |
| return "0 B" | |
| for unit in ["", "K", "M", "G", "T"]: | |
| if size < 1024: | |
| break | |
| size /= 1024 | |
| if isinstance(size, int): | |
| size = f"{size} {unit}B" | |
| elif isinstance(size, float): | |
| size = f"{size:.2f} {unit}B" | |
| return size |