units

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package units contains helpers to convert sizes to human-readable strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesPerSecondsString added in v0.9.6

func BytesPerSecondsString[T realNumber](bps T) string

BytesPerSecondsString formats the given value bytes per second with the appropriate base-10 suffix (KB/s, MB/s, GB/s, ...)

func BytesString added in v0.13.0

func BytesString[T realNumber](b T) string

BytesString formats the given value as bytes with the unit provided from the environment.

func BytesStringBase10

func BytesStringBase10[T realNumber](b T) string

BytesStringBase10 formats the given value as bytes with the appropriate base-10 suffix (KB, MB, GB, ...)

func BytesStringBase2

func BytesStringBase2[T realNumber](b T) string

BytesStringBase2 formats the given value as bytes with the appropriate base-2 suffix (KiB, MiB, GiB, ...)

func Count

func Count[T constraints.Integer](v T) string

Count returns the given number with the appropriate base-10 suffix (K, M, G, ...)

Types

This section is empty.

Jump to

Keyboard shortcuts

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