#byte #units #conversion #convert #data-size

byte_converter

A Rust library for converting bytes to various units (KB, MB, GB, etc.)

5 releases

0.1.4 Nov 21, 2024
0.1.3 Nov 21, 2024
0.1.2 Oct 31, 2024
0.1.1 Oct 29, 2024
0.1.0 Oct 29, 2024

#535 in Data structures

Download history 389/week @ 2024-10-29 44/week @ 2024-11-05 284/week @ 2024-11-19 13/week @ 2024-11-26

297 downloads per month

MIT license

4KB

byte_converter

byte_converter is a Rust library for converting between bytes, kilobytes, and megabytes.

Installation

Add byte_converter to your Cargo.toml: [dependencies] byte_converter = "0.1.0"

Usage

Then, you can use the conversion functions:

use byte_converter::{bytes_to_kb, kb_to_mb};

fn main() {
    let kb = bytes_to_kb(2048);
    println!("2048 bytes is {} KB", kb);

    let mb = kb_to_mb(2048.0);
    println!("2048 KB is {} MB", mb);
}

License

This project is licensed under the MIT License.

Author

bensatlantik

No runtime deps