rlg::utils

Function format_file_size

Source
pub fn format_file_size(size: u64) -> String
Expand description

Formats a file size in a human-readable format.

§Arguments

  • size - The file size in bytes.

§Returns

A String containing the formatted file size.

§Examples

use rlg::utils::format_file_size;

let size = 1_500_000;
let formatted = format_file_size(size);
assert_eq!(formatted, "1.43 MB");