Documentation
¶
Overview ¶
Package numfmt provides human-readable formatting for byte counts.
Adapted from github.com/dustin/go-humanize (MIT).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bytes ¶
Bytes formats a byte count as a human-readable SI string (base-1000). digits controls significant digits; trailing zeros are always stripped. Below MB, decimals are suppressed.
func BytesWidth ¶
BytesWidth returns the max formatted width (no zero stripping) for stable padding.
func CountDigits ¶
CountDigits returns the number of decimal digits in n.
func IBytes ¶
IBytes formats a byte count as a human-readable IEC string (base-1024). digits controls significant digits; trailing zeros are always stripped. Below MiB, decimals are suppressed.
func IBytesWidth ¶
IBytesWidth returns the max formatted width (no zero stripping) for stable padding.
func TrimDecimalZeros ¶
TrimDecimalZeros strips trailing zeros after a decimal point. "100.0" → "100", "82.90" → "82.9", "1.50" → "1.5", "42" → "42".
Types ¶
This section is empty.