func (*Bytes) Format(b int64) string {
	multiple := ""
	value := float64(b)
	switch {
	case b < KB:
		return strconv.FormatInt(b, 10) + "B"
	case b < MB:
		value /= KB
		multiple = "KB"
	case b < MB:
		value /= KB
		multiple = "KB"
	case b < GB:
		value /= MB
		multiple = "MB"
	case b < TB:
		value /= GB
		multiple = "GB"
	case b < PB:
		value /= TB
		multiple = "TB"
	case b < EB:
		value /= PB
		multiple = "PB"
	}
	return fmt.Sprintf("%.02f%s", value, multiple)
}
Format formats bytes integer to human readable string.
For example, 31323 bytes will return 30.59KB.
package bytes
import (
	"fmt"
	"regexp"
	"strconv"
)
type (
	Bytes struct {
	}
)
const (
	B = 1 << (10 * iota)
	KB
	MB
	GB
	TB
	PB
	EB
)
var (
	pattern = regexp.MustCompile(`(?i)^(-?\d+)([KMGTP]B?|B)$`)
	global  = New()
)
func New() *Bytes {
	return &Bytes{}
}