data-storage-unit-conversion
v1.0.2
Published
data storage unit conversion
Downloads
2
Maintainers
Readme
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
- wechat: scheisseer
- email: [email protected]
In order for your application to pass quickly, please invite a famous person when adding friends