Skip to content

demize/convert-byte-size-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

convert-byte-size-string

This crate provides functionality to convert an arbitrary byte size string such as "7.9 EiB" into a u128 value usable wherever you need it.

Usage

Add the following to your Cargo.toml:

[dependencies]
convert-byte-size-string = "1.0"

In your code, you can:

use convert_byte_size_string::convert_to_bytes;

let size: u128 = convert_to_bytes("7.9 EiB").unwrap();

Features

This library has a fairly basic set of features:

  • Convert byte size strings to u128 values based on the unit in the string, interpreting the unit as either a base 2 unit or a base 10 unit
  • Convert byte size strings based on the unit in the string, forcing the unit to be treated as either base 10 or base 2

About

Convert a byte size string to a u128 value.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages