debian-forge-composer/vendor/github.com/labstack/gommon/bytes
Diaa Sami 60e403e53e cloudapi: use Recover middleware to handle panics
recover from panics such as out-of-bounds array access & nil
pointer access, print a stack trace and return 5xx error
instead of the service crashing and relying on Execution
framework to handle crashes
2021-09-24 12:11:04 +01:00
..
bytes.go cloudapi: use Recover middleware to handle panics 2021-09-24 12:11:04 +01:00
README.md cloudapi: use Recover middleware to handle panics 2021-09-24 12:11:04 +01:00

Bytes

  • Format bytes integer to human readable bytes string.
  • Parse human readable bytes string to bytes integer.

Installation

go get github.com/labstack/gommon/bytes

Usage

Format

println(bytes.Format(13231323))

12.62MB

Parse

b, _ = Parse("2M")
println(b)

2097152