Converts the current bytes value to a given unit.
byte unit
Return whether or not the Bytes object is valid.
Returns a string representation of the Bytes object using binary (i.e. IEC) units.
formatting options
Returns a string representation of the Bytes object using decimal (i.e. SI) units.
formatting options
Returns a string representation of the Bytes object using a format specifier. Its verbs syntax is greatly inspired by C's printf.
Verbs:
%b bytes
%g gigabytes
%G gibibytes
%k kilobytes
%K kibibytes
%m megabytes
%M mebibytes
%p petabytes
%P pebibytes
%t terabytes
%T tebibytes
%v decimal unit that best matches to the value (SI)
%V binary unit that best matches to the value (IEC)
Width can be specified by a decimal number preceding the verb and the digits precision by another decimal number directly following the width, separated by a period. Both are optional and defaults will apply when omitted.
Examples:
%g width: default digits: default
%4g width: 4 digits: default
%4.g width: 4 digits: 0
%4.2g width: 4 digits: 2
%.2g width: default digits: 2
Extra modifiers are supported to alter the output format, they must precede the width and digits precision numbers.
Modifiers:
+ always print the numeric value sign
! use short form (no space, no suffix)
format specifier
formatting options
Returns a string representation of the Bytes object according to provided formatting options.
formatting options
Returns the current bytes value.
Create a new Bytes object from a numeric value.
bytes value
Return whether or not the given object is a Bytes one.
object to inspect
A Bytes object represent an amount of bytes.