Documentation ¶
Index ¶
- func FormatBytes(bytes int64) string
- func ParseString(s string) (int64, error)
- type Size
- func (size Size) Base10String() string
- func (size Size) Base2String() string
- func (size Size) EB() float64
- func (size Size) EiB() float64
- func (size Size) Float64() float64
- func (size Size) GB() float64
- func (size Size) GiB() float64
- func (size Size) Int() int
- func (size Size) Int32() int32
- func (size Size) Int64() int64
- func (size Size) KB() float64
- func (size Size) KiB() float64
- func (size Size) MB() float64
- func (size Size) MiB() float64
- func (size Size) PB() float64
- func (size Size) PiB() float64
- func (size *Size) Set(s string) error
- func (size Size) String() string
- func (size Size) TB() float64
- func (size Size) TiB() float64
- func (Size) Type() string
- type Sizes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatBytes ¶
FormatBytes converts number of bytes to appropriately sized string
func ParseString ¶
ParseString converts string to number of bytes
Types ¶
type Size ¶
type Size int64
Size implements flag.Value for collecting memory size in bytes
const ( B Size = 1 << (10 * iota) KiB MiB GiB TiB PiB EiB KB Size = 1e3 MB Size = 1e6 GB Size = 1e9 TB Size = 1e12 PB Size = 1e15 EB Size = 1e18 )
base 2 and base 10 sizes
func (Size) Base10String ¶
Base10String converts size to a string using base-10 prefixes
func (Size) Base2String ¶
Base2String converts size to a string using base-2 prefixes
Click to show internal directories.
Click to hide internal directories.