mirror of
https://github.com/KnugiHK/WhatsApp-Chat-Exporter.git
synced 2026-04-25 15:31:38 +00:00
Fix: it is impossible to have 0.1 byte as byte is the smallest unit
This commit is contained in:
@@ -85,8 +85,8 @@ def bytes_to_readable(size_bytes: int) -> str:
|
||||
Returns:
|
||||
A human-readable string representing the file size.
|
||||
"""
|
||||
if size_bytes == 0:
|
||||
return "0B"
|
||||
if size_bytes < 1024:
|
||||
return f"{size_bytes} B"
|
||||
size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB")
|
||||
i = int(math.floor(math.log(size_bytes, 1024)))
|
||||
p = math.pow(1024, i)
|
||||
|
||||
Reference in New Issue
Block a user