Vishal Rana bfff5bf046 Gytes to Bytes %!s(int64=10) %!d(string=hai) anos
..
README.md bfff5bf046 Gytes to Bytes %!s(int64=10) %!d(string=hai) anos
bytes.go bfff5bf046 Gytes to Bytes %!s(int64=10) %!d(string=hai) anos
bytes_test.go bfff5bf046 Gytes to Bytes %!s(int64=10) %!d(string=hai) anos

README.md

Bytes

Format bytes to string

Installation

go get github.com/labstack/gommon/bytes

Usage

import github.com/labstack/gommon/bytes

Decimal prefix

fmt.Println(bytes.Format(1323))

1.32 KB

Binary prefix

bytes.SetBinaryPrefix(true)
fmt.Println(bytes.Format(1323))

1.29 KiB

New instance

g := New()
fmt.Println(g.Format(13231323))