MCPcopy Create free account
hub / github.com/TechifyBots/File-Stream-Bot / human_size

Function human_size

biisal/utils/file_size.py:4–6  ·  view source on GitHub ↗

Returns a human readable string representation of bytes

(bytes, units=[' bytes','KB','MB','GB','TB', 'PB', 'EB'])

Source from the content-addressed store, hash-verified

2# (c) @biisal
3# (c) adarsh-goel
4def human_size(bytes, units=[' bytes','KB','MB','GB','TB', 'PB', 'EB']):
5 """ Returns a human readable string representation of bytes """
6 return str(bytes) + units[0] if int(bytes) < 1024 else human_size(int(bytes)>>10, units[1:])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected