Categorygithub.com/docker/go-units
modulepackage
0.5.0
Repository: https://github.com/docker/go-units.git
Documentation: pkg.go.dev

# README

GoDoc

Introduction

go-units is a library to transform human friendly measurements into machine friendly values.

Usage

See the docs in godoc for examples and documentation.

Copyright and license

Copyright © 2015 Docker, Inc.

go-units is licensed under the Apache License, Version 2.0. See LICENSE for the full text of the license.

# Functions

BytesSize returns a human-readable size in bytes, kibibytes, mebibytes, gibibytes, or tebibytes (eg.
CustomSize returns a human-readable approximation of a size using custom format.
FromHumanSize returns an integer from a human-readable specification of a size using SI standard (eg.
HumanDuration returns a human-readable approximation of a duration (eg.
HumanSize returns a human-readable approximation of a size capped at 4 valid numbers (eg.
HumanSizeWithPrecision allows the size to be in any precision, instead of 4 digit precision used in units.HumanSize.
ParseUlimit parses and returns a Ulimit from the specified string.
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.

# Constants

See: http://en.wikipedia.org/wiki/Binary_prefix.
See: http://en.wikipedia.org/wiki/Binary_prefix.
See: http://en.wikipedia.org/wiki/Binary_prefix.
See: http://en.wikipedia.org/wiki/Binary_prefix.
See: http://en.wikipedia.org/wiki/Binary_prefix.
See: http://en.wikipedia.org/wiki/Binary_prefix.
See: http://en.wikipedia.org/wiki/Binary_prefix.
See: http://en.wikipedia.org/wiki/Binary_prefix.
See: http://en.wikipedia.org/wiki/Binary_prefix.
See: http://en.wikipedia.org/wiki/Binary_prefix.

# Structs

Rlimit specifies the resource limits, such as max open files.
Ulimit is a human friendly version of Rlimit.