This library converts a file size in bytes into a human readable string.
Examples:
format 1234 == "1.23 kB"
format 238674052 == "238.67 MB"
format 543 == "543 B"You can either use decimal units (also known as base 10 units, these are the default) or binary (also called base 2 or IEC units).
Supported decimal units:
Larger decimal units (zettabyte (ZB), yottabyte (YB), ...) are not supported.
Supported binary/IEC units:
Larger binary units (exbibyte (EiB), zebibyte (ZiB), yobibytej (YiB), ...)) are not supported.
For decimal/base 10 units, the number of bytes is divided by 10^3 when going to the next larger unit. For binary/base 2 units, the number of bytes is divided by 2^10 (1024) each time. (For binary units also see https://en.wikipedia.org/wiki/Kibibyte.)
Formats the given file size with the default settings, returning the number and units separately, in a tuple.
Formats the given file size with the binary/base2/IEC unit.
Formats the given file size with the binary/base2/IEC unit, returning the number and units separately, in a tuple.
Formats the given file size with the given settings.
Formats the given file size with the given settings, returning the number and units separately, in a tuple.
The default settings. When using formatWith, it is recommended to obtain
a settings record with this function and modify the settings to your liking.
Use a settings record together with formatWith to customize the formatting
process. The available options are:
units: use either decimal or binary/IEC units (the default is to use decimal
units),decimalPlaces: the number of decimal places (digits after the decimal
separator, the default is 2) anddecimalSeparator: the decimal separator to use (default ".").The two possible unit types, either decimal/base 10 (kb, MB, GB, ...) or binary/IEC/base 2 (KiB, MiB, GiB, ...), see above.
Formats the given file size with the default settings.
Convenience function for