-
-
Notifications
You must be signed in to change notification settings - Fork 772
Closed
Labels
Description
Binary: 2,427,344 bytes
would be nicer - even better, include a tooltip showing that size translated using this function:
datasette/datasette/utils/__init__.py
Lines 837 to 846 in 138e4d9
def format_bytes(bytes): | |
current = float(bytes) | |
for unit in ("bytes", "KB", "MB", "GB", "TB"): | |
if current < 1024: | |
break | |
current = current / 1024 | |
if unit == "bytes": | |
return f"{int(current)} {unit}" | |
else: | |
return f"{current:.1f} {unit}" |