Skip to content

jimrazmus/bytes2string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bytes2string

Go Report Card Go Reference License

Summary

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'.

Installation

go get github.com/jimrazmus/bytes2string

Usage

First, import the module.

import github.com/jimrazmus/bytes2string

Then, use the provided functions.

log.Println(ByteCountSI(12345678))

log.Println(ByteCountIEC(12345678))

Contributing

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.

Author

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.

License

This project is licensed under the MIT License - see the LICENSE.txt file for details.

About

Go module for converting int64 byte counts to SI and IEC string format

Resources

License

Stars

Watchers

Forks

Packages

No packages published