Golang:go-humanize将文件大小转换成Kb、Mb、Gb适合人类阅读的单位
Golang:go-humanize将文件大小转换成Kb、Mb、Gb适合人类阅读的单位
最近去了昆明的教场中路体验了满屏蓝花楹,感受到了梦幻般的世界,随手拍了一张图,分享给大家,有时间可以去一趟,体验一次,顺便说一下,美女很多喔
Go Humans! (formatters for units to human friendly sizes)
译文:加油人类!(适合人类使用的单位的格式化程序)
文档
- pkg.go https://pkg.go.dev/github.com/dustin/go-humanize
- github https://github.com/dustin/go-humanize
安装
go get github.com/dustin/go-humanize
示例
package main
import (
"fmt"
"github.com/dustin/go-humanize"
)
func main() {
fmt.Println(humanize.Bytes(8285))
// 8.3 kB
fmt.Println(humanize.Bytes(82854982))
// 83 MB
}
回复:【golang加群】加入golang开发者交流群