New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

data-storage-unit-conversion

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

data-storage-unit-conversion

data storage unit conversion

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

FAQs

Package last updated on 27 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc