data-storage-unit-conversion
any data storage unit conversion
Install
npm i data-storage-unit-conversion
How to use
import DataStorageUnit from "data-storage-unit-conversion";
const dataStorageUnit = new DataStorageUnit();
const MB2GBResult = dataStorageUnit.converter(1224, "MB", "GB");
console.log("k --> g ==>", MB2GBResult);
const KB2MBResult = dataStorageUnit.getOne("KB").to(103894, "MB");
console.log("k --> m ==>", KB2MBResult);
const unit = dataStorageUnit.getUnit("Bit");
const result = unit?.convertedRule.call(dataStorageUnit, 100, "TB", "KB");
console.log("TB --> KB", result);
Optional unit
"Bit", "Byte", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB", "DB", "NB"
Demos
We provide some common demos, Click to view
Note
We consider some special scenarios, you may need to use units that exceed TB level, so the internal conversion from Bit to NB to unit is preset; but this may cause you to switch from a large unit to a comparison In small units, the result exceeds the maximum range of numbers;
If you have such a demand, this library may not be suitable for you so far; Of course we will solve this problem in the near future, but it may be delayed for some time (there is no spare time to deal with it)
We also welcome you to submit pull request for us;
Contact the author
If you have any questions during use, please feel free to contact us
In order for your application to pass quickly, please invite a famous person when adding friends