units

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package units is taken from https://github.com/docker/go-units

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesSize

func BytesSize(size float64) string

BytesSize returns a human-readable size in bytes, kibibytes, mebibytes, gibibytes, or tebibytes (eg. "44.2kiB", "17.6MiB").

func CustomSize

func CustomSize(format string, size float64, base float64, unitList []string) string

CustomSize returns a human-readable approximation of a size using custom format.

func HumanSize

func HumanSize(size float64) string

HumanSize returns a human-readable approximation of a size with a width of 5 (eg. "2.746MB", "796.0KB").

func HumanSizeWithPrecision

func HumanSizeWithPrecision(size float64, width, precision int) string

HumanSizeWithPrecision allows the size to be in any precision.

Types

This section is empty.

Jump to

Keyboard shortcuts

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