2024-12-24 21:57:34 +03:00
|
|
|
## Data size units converter
|
|
|
|
|
|
|
|
Installation:
|
|
|
|
|
|
|
|
```
|
|
|
|
v install --git https://github.com/gechandesu/dataunits
|
|
|
|
```
|
2024-12-22 05:22:17 +03:00
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
```v
|
|
|
|
import dataunits
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
kilobytes := dataunits.convert(500, dataunits.mbit, dataunits.kb)
|
2024-12-22 05:37:42 +03:00
|
|
|
println(kilobytes) // 62500.0
|
2024-12-22 05:22:17 +03:00
|
|
|
|
|
|
|
mebibytes := (dataunits.gib * 15).mib()
|
2024-12-22 05:37:42 +03:00
|
|
|
println(mebibytes) // 15360.0
|
2024-12-22 05:22:17 +03:00
|
|
|
|
|
|
|
bytes := dataunits.DataSize(2000 * dataunits.gib).bytes()
|
2024-12-22 05:37:42 +03:00
|
|
|
println(bytes) // 2.147483648e+12 == 2147483648000
|
2024-12-22 05:22:17 +03:00
|
|
|
}
|
|
|
|
```
|