diff options
author | Caleb Bassi <calebjbassi@gmail.com> | 2018-02-18 23:25:02 -0800 |
---|---|---|
committer | Caleb Bassi <calebjbassi@gmail.com> | 2018-02-19 02:00:21 -0800 |
commit | 40775db60b90cd290a206108cc4d22b236be9ba5 (patch) | |
tree | 28b5e5d7921a399cdcc8fb9559df0e69a31354be /utils |
Initial commit
Diffstat (limited to 'utils')
-rw-r--r-- | utils/utils.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/utils/utils.go b/utils/utils.go new file mode 100644 index 0000000..684a87b --- /dev/null +++ b/utils/utils.go @@ -0,0 +1,17 @@ +package utils + +import ( + "math" +) + +func BytesToKB(b int) int { + return int((float64(b) / math.Pow10(3))) +} + +func BytesToMB(b int) int { + return int((float64(b) / math.Pow10(6))) +} + +func BytesToGB(b int) int { + return int((float64(b) / math.Pow10(9))) +} |