Documentation ¶
Index ¶
Constants ¶
View Source
const ( BYTE = 1 << (10 * iota) KILOBYTE MEGABYTE GIGABYTE TERABYTE PETABYTE EXABYTE )
View Source
const ( KILO = 1000 MEGA = 1000 * KILO GIGA = 1000 * MEGA )
Variables ¶
This section is empty.
Functions ¶
func HumanizeBytes ¶ added in v1.5.2
func HumanizeBytes(size interface{}) string
ByteSize returns a human-readable byte string of the form 10M, 12.5K, and so forth. The following units are available:
E: Exabyte P: Petabyte T: Terabyte G: Gigabyte M: Megabyte K: Kilobyte B: Byte
The unit that results in the smallest number greater than or equal to 1 is always chosen. Input is the size in bytes.
func HumanizeDuration ¶ added in v1.5.2
Returns a string representing of a duration in the form "3d1h3m".
Leading zero units are omitted. As a special case, durations less than one second format use a smaller unit (milli-, micro-, or nanoseconds) to ensure that the leading digit is non-zero. Duration more than a day or more than a week lose granularity and are truncated to resp. days-hours-minutes and weeks-days-hours. The zero duration formats as 0s.
func HumanizeInt ¶ added in v1.29.1
func HumanizeInt(size interface{}) string
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.