package units
import "github.com/docker/docker/pkg/units"
Index ¶
- Constants
- func BytesSize(size float64) string
- func FromHumanSize(size string) (int64, error)
- func HumanDuration(d time.Duration) string
- func HumanSize(size float64) string
- func RAMInBytes(size string) (int64, error)
Constants ¶
const ( KB = 1000 MB = 1000 * KB GB = 1000 * MB TB = 1000 * GB PB = 1000 * TB KiB = 1024 MiB = 1024 * KiB GiB = 1024 * MiB TiB = 1024 * GiB PiB = 1024 * TiB )
See: http://en.wikipedia.org/wiki/Binary_prefix
Functions ¶
func BytesSize ¶
func FromHumanSize ¶
FromHumanSize returns an integer from a human-readable specification of a size using SI standard (eg. "44kB", "17MB")
func HumanDuration ¶
HumanDuration returns a human-readable approximation of a duration (eg. "About a minute", "4 hours ago", etc.)
func HumanSize ¶
HumanSize returns a human-readable approximation of a size using SI standard (eg. "44kB", "17MB")
func RAMInBytes ¶
RAMInBytes parses a human-readable string representing an amount of RAM in bytes, kibibytes, mebibytes, gibibytes, or tebibytes and returns the number of bytes, or -1 if the string is unparseable. Units are case-insensitive, and the 'b' suffix is optional.
Source Files ¶
- Version
- v1.5.0
- Published
- Feb 10, 2015
- Platform
- js/wasm
- Imports
- 5 packages
- Last checked
- 7 minutes ago –
Tools for package owners.