bytesize

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2015 License: MIT Imports: 3 Imported by: 0

Documentation

Index

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL