Go module for converting int64 byte counts to a shortened SI, or IEC, string format. For example, 1000000 to '1.0 MB' or 1048576 to '1.0 MiB'.
go get github.com/jimrazmus/bytes2string
First, import the module.
import github.com/jimrazmus/bytes2string
Then, use the provided functions.
log.Println(ByteCountSI(12345678))
log.Println(ByteCountIEC(12345678))
Please follow the Conventional Commits specification for your commit messages. Commit type options include: feat, fix, build, chore, ci, docs, style, refactor, perf, and test.
Open a pull request when you have completed your work and want it reviewed for inclusion.
Functions originate here: https://yourbasic.org/golang/formatting-byte-size-to-human-readable-format/
Jim Razmus II - Minor modifications and formatting, along with adding testing and packaging.
This project is licensed under the MIT License - see the LICENSE.txt file for details.