bytesize

package
v2.19.4 Latest Latest
Warning

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

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

Documentation

Overview

Package bytesize provides easy conversions from human readable strings (eg. 10MB) to bytes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteSize

type ByteSize uint64

ByteSize is the size in bytes

const (
	KB ByteSize = 1000
	MB ByteSize = 1000 * KB
	GB ByteSize = 1000 * MB
	TB ByteSize = 1000 * GB
	PB ByteSize = 1000 * TB
	EB ByteSize = 1000 * PB

	KiB ByteSize = 1024
	MiB ByteSize = 1024 * KiB
	GiB ByteSize = 1024 * MiB
	TiB ByteSize = 1024 * GiB
	PiB ByteSize = 1024 * TiB
	EiB ByteSize = 1024 * PiB
)

List of available byte sizes NOTE: max is exabyte as we convert to uint64

func Parse

func Parse(s string) (ByteSize, error)

Parse parses a Bytesize from a string

func (ByteSize) Bytes

func (b ByteSize) Bytes() uint64

Bytes converts the ByteSize to an uint64

func (ByteSize) String

func (b ByteSize) String() string

String converts the ByteSize to a string

Jump to

Keyboard shortcuts

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