{"modulePath":"github.com/labstack/gommon","version":"v0.5.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package bytes\n\n## Constants\n\n```go\nconst (\n\tKiB\n\tMiB\n\tGiB\n\tTiB\n\tPiB\n\tEiB\n)\n```\nbinary units (IEC 60027)\n\n```go\nconst (\n\tKB = 1000\n\tMB = KB * 1000\n\tGB = MB * 1000\n\tTB = GB * 1000\n\tPB = TB * 1000\n\tEB = PB * 1000\n)\n```\ndecimal units (SI international system of units)\n\n## Functions\n\n```go\nfunc Format(value int64) string\n```\nFormat wraps global Bytes's Format function.\n\n```go\nfunc FormatBinary(value int64) string\n```\nFormatBinary wraps global Bytes's FormatBinary function.\n\n```go\nfunc FormatDecimal(value int64) string\n```\nFormatDecimal wraps global Bytes's FormatDecimal function.\n\n```go\nfunc Parse(value string) (int64, error)\n```\nParse wraps global Bytes's Parse function.\n\n## Types\n\n```go\ntype Bytes struct{}\n```\nBytes struct\n\n```go\nfunc New() *Bytes\n```\nNew creates a Bytes instance.\n\n```go\nfunc (b *Bytes) Format(value int64) string\n```\nFormat formats bytes integer to human readable string according to IEC 60027. For example, 31323 bytes will return 30.59KB.\n\n```go\nfunc (*Bytes) FormatBinary(value int64) string\n```\nFormatBinary formats bytes integer to human readable string according to IEC 60027. For example, 31323 bytes will return 30.59KB.\n\n```go\nfunc (*Bytes) FormatDecimal(value int64) string\n```\nFormatDecimal formats bytes integer to human readable string according to SI international system of units. For example, 31323 bytes will return 31.32KB.\n\n```go\nfunc (b *Bytes) Parse(value string) (int64, error)\n```\nParse parses human readable bytes string to bytes integer. For example, 6GiB (6Gi is also valid) will return 6442450944, and 6GB (6G is also valid) will return 6000000000.\n\n```go\nfunc (*Bytes) ParseBinary(value string) (i int64, err error)\n```\nParseBinary parses human readable bytes string to bytes integer. For example, 6GiB (6Gi is also valid) will return 6442450944.\n\n```go\nfunc (*Bytes) ParseDecimal(value string) (i int64, err error)\n```\nParseDecimal parses human readable bytes string to bytes integer. For example, 6GB (6G is also valid) will return 6000000000.\n\n","path":"github.com/labstack/gommon/bytes","name":"bytes","synopsis":"","isRedistributable":true}
