text

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: Apache-2.0 Imports: 11 Imported by: 17

Documentation

Index

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

func HumanizeBytes(bytes uint64) string

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

func HumanizeDuration(duration time.Duration) string

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 SafeRead

func SafeRead(r io.Reader) string

func Template

func Template(template string, vars interface{}) (string, error)

Template templates out a template using gomplate

func ToFile

func ToFile(text string, ext string) string

ToFile saves text as a temp file with an extension

Types

This section is empty.

Jump to

Keyboard shortcuts

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