modify BytesToSize

This commit is contained in:
Nite07 2024-11-22 02:10:03 +08:00
parent 434dbb1dc2
commit 05dc9e190a

View File

@ -54,7 +54,7 @@ func BytesToSize(size uint64) string {
_ = iota _ = iota
KB uint64 = 1 << (10 * iota) KB uint64 = 1 << (10 * iota)
MB MB
GB GBc
TB TB
) )
switch { switch {
@ -65,6 +65,6 @@ func BytesToSize(size uint64) string {
case size >= KB: case size >= KB:
return fmt.Sprintf("%.1f KB", float64(size)/float64(KB)) return fmt.Sprintf("%.1f KB", float64(size)/float64(KB))
default: default:
return fmt.Sprintf("%d Bytes", size) return fmt.Sprintf("%d B", size)
} }
} }