add printer.ByteString() as shortcut

This commit is contained in:
2026-07-08 13:44:45 +02:00
parent b20f3b39a3
commit 56c636fa2a
2 changed files with 15 additions and 8 deletions

View File

@@ -22,10 +22,15 @@ type ByteSize struct {
size uint64
}
func (b *ByteSize) String() string {
return humanize.Bytes(b.size)
}
func Bytes(size int64) *ByteSize {
return &ByteSize{size: uint64(size)}
}
func (b *ByteSize) String() string {
return humanize.Bytes(b.size)
func ByteString(size int64) string {
b := ByteSize{size: uint64(size)}
return b.String()
}