Documentation ¶
Overview ¶
Package datasize implements a type representing data sizes in bytes.
Index ¶
- Constants
- type Size
- func (s Size) Bytes() uint64
- func (s Size) Gibibytes() float64
- func (s Size) Gigabytes() float64
- func (s Size) Kibibytes() float64
- func (s Size) Kilobytes() float64
- func (s Size) Mebibytes() float64
- func (s Size) Megabytes() float64
- func (s Size) Pebibytes() float64
- func (s Size) Petabytes() float64
- func (s Size) String() string
- func (s Size) Tebibytes() float64
- func (s Size) Terabytes() float64
Constants ¶
View Source
const ( Kilobyte Size = 1000 * Byte Megabyte = 1000 * Kilobyte Gigabyte = 1000 * Megabyte Terabyte = 1000 * Gigabyte Petabyte = 1000 * Terabyte )
Common decimal data sizes
View Source
const ( Byte Size = 1 Kibibyte = 1024 * Byte Mebibyte = 1024 * Kibibyte Gibibyte = 1024 * Mebibyte Tebibyte = 1024 * Gibibyte Pebibyte = 1024 * Tebibyte )
Common binary data sizes
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Size ¶
type Size uint64
Size represents the size of data in bytes.
func Parse ¶
Parse parses a Size from a string. A Size is an unsigned decimal number with an optional fraction and a unit suffix. Examples: "0", "10B", "1kB", "4GB", "5GiB". Valid units are "B", (decimal: "kB", "MB", "GB, "TB, "PB"), (binary: "KiB", "MiB", "GiB", "TiB", "PiB")
Click to show internal directories.
Click to hide internal directories.