kibi

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DigitRegex = regexp.MustCompile(`\d+`)
View Source
var ErrInvalidByteSizeString = fmt.Errorf("Invalid byte size string")

Functions

func FormatBytes

func FormatBytes(b int64) string

func FormatBytesHighPrecision

func FormatBytesHighPrecision(b int64) string

Like FormatBytes, but with 3 decimal places of precision

func ParseBytes

func ParseBytes(v string) (int64, error)

We support suffixes 'mb', 'kb', 'gb', etc. We also support suffixes of just the letter, eg 'm', 'g', etc. Examples: 123 m -> 123*1024*1024 123 mb -> 123*1024*1024 123 GB -> 123*1024*1024*1024 123 T -> 123*1024*1024*1024*1024 123 P -> 123*1024*1024*1024*1024*1024

Types

This section is empty.

Jump to

Keyboard shortcuts

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