size

package
v0.0.0-...-8223eb1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package size provides a converter between a string representation of a size and a number of bytes, and reverse.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteCount

type ByteCount float64
const (
	Byte ByteCount = 1 << (10 * iota)
	Kibibyte
	Mebibyte
	Gibibyte
	Tebibyte
)

func Parse

func Parse(sizeStr string) (ByteCount, error)

Parse a string containing a string representation of a byte count.

func (ByteCount) Int64

func (b ByteCount) Int64() int64

func (ByteCount) MarshalYAML

func (b ByteCount) MarshalYAML() (interface{}, error)

MarshalYAML() serializes a ByteCount into YAML. To maintain a canonical representation of the value and to preserve compatibility with older parsers, the byte count will always be serialized as a plain integer without a suffix.

func (ByteCount) String

func (b ByteCount) String() string

func (*ByteCount) UnmarshalYAML

func (b *ByteCount) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unserializes a YAML representation of the ByteCount.

Jump to

Keyboard shortcuts

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