MCPcopy
hub / github.com/vasusen-code/SaveRestrictedContentBot / humanbytes

Function humanbytes

main/plugins/progress.py:67–76  ·  view source on GitHub ↗
(size)

Source from the content-addressed store, hash-verified

65
66
67def humanbytes(size):
68 if not size:
69 return ""
70 power = 2**10
71 n = 0
72 Dic_powerN = {0: ' ', 1: 'Ki', 2: 'Mi', 3: 'Gi', 4: 'Ti'}
73 while size > power:
74 size /= power
75 n += 1
76 return str(round(size, 2)) + " " + Dic_powerN[n] + 'B'
77
78
79def TimeFormatter(milliseconds: int) -> str:

Callers 1

progress_for_pyrogramFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected