humanize

package module
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize instead.
	Byte = 1 << (iota * 10)

	// Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize instead.
	KiByte

	// Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize instead.
	MiByte

	// Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize instead.
	GiByte

	// Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize instead.
	TiByte

	// Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize instead.
	PiByte

	// Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize instead.
	EiByte
)
View Source
const (

	// Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize instead.
	IByte = 1

	// Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize instead.
	KByte = IByte * 1000

	// Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize instead.
	MByte = KByte * 1000

	// Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize instead.
	GByte = MByte * 1000

	// Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize instead.
	TByte = GByte * 1000

	// Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize instead.
	PByte = TByte * 1000

	// Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize instead.
	EByte = PByte * 1000

	// Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize instead.
	ZByte = EByte * 1000
)

Variables

This section is empty.

Functions

func Bytes deprecated

func Bytes(s uint64) string

Bytes converts a byte count into a human-readable string using decimal (SI) units (kB, MB, GB, etc.). It uses a base of 1000 (1 kB = 1000 bytes).

Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize.ByteSI(s).String() instead.

func Duration added in v0.4.0

func Duration(d time.Duration, short bool) string

Duration formats a time.Duration into a human-readable string. It supports both full and short formats.

func IBytes deprecated

func IBytes(s uint64) string

IBytes converts a byte count into a human-readable string using binary (IEC) units (KiB, MiB, GiB, etc.). It uses a base of 1024 (1 KiB = 1024 bytes).

Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize.IECSize(s).String() instead.

func ParseBytes deprecated

func ParseBytes(s string) (uint64, error)

ParseBytes parses a string representation of bytes (like "1.5 GB" or "1024 B") and returns the number of bytes it represents. It supports both decimal (SI) and binary (IEC) units and handles values with commas as well.

Deprecated: Use github.com/happy-sdk/happy/pkg/bytesize.Parse(s) instead.

Types

This section is empty.

Jump to

Keyboard shortcuts

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