summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorCaleb Bassi <calebjbassi@gmail.com>2018-02-18 23:25:02 -0800
committerCaleb Bassi <calebjbassi@gmail.com>2018-02-19 02:00:21 -0800
commit40775db60b90cd290a206108cc4d22b236be9ba5 (patch)
tree28b5e5d7921a399cdcc8fb9559df0e69a31354be /utils
Initial commit
Diffstat (limited to 'utils')
-rw-r--r--utils/utils.go17
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)))
+}