(bytes int64)
| 572 | } |
| 573 | |
| 574 | func formatSize(bytes int64) string { |
| 575 | const unit = 1024 |
| 576 | if bytes < unit { |
| 577 | return fmt.Sprintf("%d B", bytes) |
| 578 | } |
| 579 | div, exp := int64(unit), 0 |
| 580 | for n := bytes / unit; n >= unit; n /= unit { |
| 581 | div *= unit |
| 582 | exp++ |
| 583 | } |
| 584 | return fmt.Sprintf("%.1f %cB", float64(bytes)/float64(div), "KMGTPE"[exp]) |
| 585 | } |
no outgoing calls
no test coverage detected