(size int64)
| 58 | } |
| 59 | |
| 60 | func FormatBytes(size int64) string { |
| 61 | units := []string{" B", " KB", " MB", " GB", " TB"} |
| 62 | |
| 63 | s := float64(size) |
| 64 | |
| 65 | i := 0 |
| 66 | |
| 67 | for ; s >= 1024 && i < 4; i++ { |
| 68 | s /= 1024 |
| 69 | } |
| 70 | |
| 71 | return fmt.Sprintf("%.2f%s", s, units[i]) |
| 72 | } |
| 73 | |
| 74 | func Round(val float64, places int) float64 { |
| 75 | var t float64 |
no outgoing calls
no test coverage detected