datasize

package
v0.0.0-...-0a103c7 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B  ByteSize = 1
	KB          = B << 10
	MB          = KB << 10
	GB          = MB << 10
	TB          = GB << 10
	PB          = TB << 10
	EB          = PB << 10
)

Variables

View Source
var ErrBits = errors.New("unit with capital unit prefix and lower case unit (b) - bits, not bytes ")

Functions

func HumanSize

func HumanSize(bytes uint64) (s string, err error)

func Parse

func Parse(s string) (bytes uint64, err error)

Types

type ByteSize

type ByteSize uint64

func (ByteSize) Bytes

func (b ByteSize) Bytes() uint64

func (ByteSize) EBytes

func (b ByteSize) EBytes() float64

func (ByteSize) GBytes

func (b ByteSize) GBytes() float64

func (ByteSize) HR

func (b ByteSize) HR() string

func (ByteSize) HumanReadable

func (b ByteSize) HumanReadable() string

func (ByteSize) KBytes

func (b ByteSize) KBytes() float64

func (ByteSize) MBytes

func (b ByteSize) MBytes() float64

func (ByteSize) MarshalText

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

func (ByteSize) PBytes

func (b ByteSize) PBytes() float64

func (ByteSize) String

func (b ByteSize) String() string

func (ByteSize) TBytes

func (b ByteSize) TBytes() float64

func (*ByteSize) UnmarshalText

func (b *ByteSize) UnmarshalText(t []byte) error

Jump to

Keyboard shortcuts

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