Go Humans! (formatters for units to human friendly sizes)
译文:加油人类!(适合人类使用的单位的格式化程序)
安装
go get /dustin/go-humanize
示例
package main import ( "fmt" "/dustin/go-humanize" ) func main() { fmt.Println(humanize.Bytes(8285)) // 8.3 kB fmt.Println(humanize.Bytes(82854982)) // 83 MB }