bytes

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func Format

func Format(b uint64) string

Format wraps global Bytes's Format function.

func Parse

func Parse(val string) (uint64, error)

Parse wraps global Bytes's Parse function.

Types

type Bytes

type Bytes struct {
}

func New

func New() *Bytes

New creates a Bytes instance.

func (*Bytes) Format

func (*Bytes) Format(b uint64) string

Format formats bytes integer to human readable string. For example, 31323 bytes will return 30.59KB.

func (*Bytes) Parse

func (*Bytes) Parse(value string) (i uint64, err error)

Parse parses human readable bytes string to bytes integer. For example, 6GB (6G is also valid) will return 6442450944.

Jump to

Keyboard shortcuts

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