Documentation
¶
Overview ¶
Package convert provides function to convert and humanize units
Index ¶
Examples ¶
Constants ¶
View Source
const IECBase = 1024
IECBase is the exponential base for IEC units.
View Source
const SIBase = 1000
SIBase is the exponential base for SI units.
Variables ¶
View Source
var ByteIECUnits = []string{"B", "KiB", "MiB", "GiB", "TiB", "PiB"}
ByteIECUnits lists known units we can convert to based on uint64.
View Source
var ByteSIUnits = []string{"B", "KB", "MB", "GB", "TB", "PB"}
ByteSIUnits lists known units we can convert to based on uint64.
Functions ¶
func BytesIEC ¶ added in v0.3.0
BytesIEC returns the biggest sensible unit for the byte value with 2 decimal precision. When value is smaller than 2 render it with a lower scale.
Example ¶
b := BytesIEC(999 * 1024) fmt.Println(b)
Output: 999KiB
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.