Download telegbot/FileStream/utils/human_readable.py from AZLABS/TGFS: direct link, hf CLI and curl.
- Browser
- Download file 277 Bytes
-
https://huggingface.co/spaces/AZLABS/TGFS/resolve/main/telegbot/FileStream/utils/human_readable.py
- Command line
-
hf download hf://spaces/AZLABS/TGFS/telegbot/FileStream/utils/human_readable.py
-
curl -L -o human_readable.py https://huggingface.co/spaces/AZLABS/TGFS/resolve/main/telegbot/FileStream/utils/human_readable.py
277 Bytes
| def humanbytes(size): | |
| if not size: | |
| return "" | |
| power = 2**10 | |
| n = 0 | |
| Dic_powerN = {0: ' ', 1: 'Ki', 2: 'Mi', 3: 'Gi', 4: 'Ti'} | |
| while size > power: | |
| size /= power | |
| n += 1 | |
| return str(round(size, 2)) + " " + Dic_powerN[n] + 'B' | |