Documentation
¶
Index ¶
- Constants
- func HumanizeBytes(bytes uint64) string
- func HumanizeDuration(duration time.Duration) string
- func SafeRead(r io.Reader) string
- func Template(template string, vars interface{}) (string, error)
- func TemplateWithDelims(template, openingDelims, closingDelims string, vars interface{}) (string, error)
- func ToFile(text string, ext string) string
Constants ¶
View Source
const ( BYTE = 1 << (10 * iota) KILOBYTE MEGABYTE GIGABYTE TERABYTE PETABYTE EXABYTE )
Variables ¶
This section is empty.
Functions ¶
func HumanizeBytes ¶ added in v1.5.2
ByteSize returns a human-readable byte string of the form 10M, 12.5K, and so forth. The following units are available:
E: Exabyte P: Petabyte T: Terabyte G: Gigabyte M: Megabyte K: Kilobyte B: Byte
The unit that results in the smallest number greater than or equal to 1 is always chosen.
func HumanizeDuration ¶ added in v1.5.2
HumanizeDuration formats a time duration to human readable format The duration in floored to the nearest unit. so 75 seconds becomes 1 minute biggest unit is days (no weeks, months or years )
func TemplateWithDelims ¶ added in v1.5.8
func TemplateWithDelims(template, openingDelims, closingDelims string, vars interface{}) (string, error)
TemplateWithDelims templates out a template using gomplate using the given opening and closing Delims
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.