byteformats

package
v0.7.14 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: GPL-2.0 Imports: 6 Imported by: 8

Documentation

Index

Constants

View Source
const (
	Byte = 1 << (iota * 10)
	KiByte
	MiByte
	GiByte
	TiByte
	PiByte
	EiByte
)
View Source
const (
	KByte = Byte * 1000
	MByte = KByte * 1000
	GByte = MByte * 1000
	TByte = GByte * 1000
	PByte = TByte * 1000
	EByte = PByte * 1000
)

Variables

This section is empty.

Functions

func FormatBytes

func FormatBytes(s uint64) string

func FormatIBytes

func FormatIBytes(s uint64) string

func FormatMemoryBytes

func FormatMemoryBytes(s uint64) string

Types

type Bytes

type Bytes struct {
	// contains filtered or unexported fields
}

func (Bytes) MarshalJSON

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

func (*Bytes) UnmarshalJSON

func (b *Bytes) UnmarshalJSON(bytes []byte) error

func (*Bytes) Value

func (b *Bytes) Value() uint64

type MemoryBytes

type MemoryBytes struct {
	// contains filtered or unexported fields
}

func (MemoryBytes) MarshalJSON

func (b MemoryBytes) MarshalJSON() ([]byte, error)

func (*MemoryBytes) UnmarshalJSON

func (m *MemoryBytes) UnmarshalJSON(bytes []byte) error

func (*MemoryBytes) Value

func (m *MemoryBytes) Value() uint64

type NetworkBytes

type NetworkBytes struct {
	// contains filtered or unexported fields
}

func (NetworkBytes) MarshalJSON

func (b NetworkBytes) MarshalJSON() ([]byte, error)

func (*NetworkBytes) UnmarshalJSON

func (n *NetworkBytes) UnmarshalJSON(bytes []byte) error

func (*NetworkBytes) Value

func (n *NetworkBytes) Value() uint64

type NetworkBytesCompat

type NetworkBytesCompat struct {
	// contains filtered or unexported fields
}

func (NetworkBytesCompat) MarshalJSON

func (b NetworkBytesCompat) MarshalJSON() ([]byte, error)

func (*NetworkBytesCompat) UnmarshalJSON

func (n *NetworkBytesCompat) UnmarshalJSON(bytes []byte) error

func (*NetworkBytesCompat) Value

func (n *NetworkBytesCompat) Value() uint64

Jump to

Keyboard shortcuts

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