2024-12-24 08:09:46 +03:00
|
|
|
## The data size units converter
|
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
|
|
|
}
|
|
|
|
```
|