bytes_string

sofia_redux.toolkit.utilities.func.bytes_string(size_bytes)[source]

Convert a number of bytes to a string with correct suffix

Parameters:
size_bytesfloat or int
Returns:
str

Formated as x.xxNB where x represents an integer and N is one of {B, K, M, G, T, P, E, Z, Y}

Examples

>>> from sofia_redux.toolkit.utilities.func import bytes_string
>>> print(bytes_string(2e10))
18.63GB