MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / format_bytes

Function format_bytes

atomic-cli/tests/fixtures/helpers_c6.rs:352–360  ·  view source on GitHub ↗

Format a byte count for display.

(bytes: u64)

Source from the content-addressed store, hash-verified

350
351/// Format a byte count for display.
352fn format_bytes(bytes: u64) -> String {
353 if bytes >= 1024 * 1024 {
354 format!("{:.1} MB", bytes as f64 / (1024.0 * 1024.0))
355 } else if bytes >= 1024 {
356 format!("{:.1} KB", bytes as f64 / 1024.0)
357 } else {
358 format!("{} B", bytes)
359 }
360}
361
362// Error Conversion
363

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected