Documentation ¶ Index ¶ Constants func MustSize(size string) (s uint64) func Size(size string) (uint64, error) func SizeDef(size string, defSize uint64) (s uint64) func ToHuman(size uint64) string Constants ¶ View Source const ( // *BASE defines the base size of *B, include K,M,G,T,P BASE uint64 = 1 << 10 // 1024 KB = BASE MB = BASE * KB GB = BASE * MB TB = BASE * GB PB = BASE * TB ) Variables ¶ This section is empty. Functions ¶ func MustSize ¶ func MustSize(size string) (s uint64) MustSize is same as Size, on error panic func Size ¶ func Size(size string) (uint64, error) Size convert byte count string to integer such as: 1K/k -> 1024, 1M/m -> 1024*1024 func SizeDef ¶ func SizeDef(size string, defSize uint64) (s uint64) SizeDef is same as Size, on error return default size func ToHuman ¶ added in v0.2.3 func ToHuman(size uint64) string Types ¶ This section is empty. Source Files ¶ View all Source files bytesize.go Click to show internal directories. Click to hide internal directories.