bytesize

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Kilobyte = 1000 * Byte
	Megabyte = 1000 * Kilobyte
	Gigabyte = 1000 * Megabyte
	Terabyte = 1000 * Gigabyte
	Petabyte = 1000 * Terabyte
	Exabyte  = 1000 * Petabyte
)

Metric system representation

View Source
const (
	Kibibyte = 1024 * Byte
	Mebibyte = 1024 * Kibibyte
	Gibibyte = 1024 * Mebibyte
	Tebibyte = 1024 * Gibibyte
	Pebibyte = 1024 * Tebibyte
	Exbibyte = 1024 * Pebibyte
)

IEC system representation.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bytes

type Bytes int64

Bytes is the multiple-byte unit.

const Byte Bytes = 1

Byte is the lowest byte unit.

func ParseBytes

func ParseBytes(s string) (Bytes, error)

ParseBytes parses a unit string. Valid time units are "B", "kB", "KB", "MB", "GB", "TB", "PB", "EB", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB" nolint: gocognit

func (Bytes) Exabytes

func (b Bytes) Exabytes() float64

Exabytes gets the float value as metric exabytes.

func (Bytes) Gigabytes

func (b Bytes) Gigabytes() float64

Gigabytes gets the float value as metric gigabytes.

func (Bytes) HumanReadable

func (b Bytes) HumanReadable() string

HumanReadable gets the human-readable

func (Bytes) Kilobytes

func (b Bytes) Kilobytes() float64

Kilobytes gets the float value as metric kilobytes.

func (Bytes) MarshalText

func (b Bytes) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler interface.

func (Bytes) Megabytes

func (b Bytes) Megabytes() float64

Megabytes gets the float value as metric megabytes.

func (Bytes) Petabytes

func (b Bytes) Petabytes() float64

Petabytes gets the float value as metric petabytes.

func (Bytes) String

func (b Bytes) String() string

func (Bytes) Terabytes

func (b Bytes) Terabytes() float64

Terabytes gets the float value as metric terabytes.

func (*Bytes) UnmarshalText

func (b *Bytes) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler interface.

Jump to

Keyboard shortcuts

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