2024-12-22 05:22:17 +03:00
2024-12-22 05:22:17 +03:00
2024-12-22 05:22:17 +03:00
2024-12-22 05:22:17 +03:00
2024-12-22 05:22:17 +03:00

Data size units converter

Installation:

v install --git https://github.com/gechandesu/dataunits

Example:

import dataunits

fn main() {
	// convert via convert fn
	kilobytes := dataunits.convert(500, dataunits.mbit, dataunits.kb)
	println(kilobytes) // 62500.0

	// convert via DataSize method (the arguments order matters)
	mebibytes := (dataunits.gib * 15).mib()
	println(mebibytes) // 15360.0

	// convert via DataSize method with explicit type cast
	bytes := dataunits.DataSize(2000 * dataunits.gib).byte()
	println(bytes) // 2.147483648e+12 == 2147483648000
}
Description
Languages
V 97%
Makefile 3%