1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 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))) }