bits2bytes

1.0.0 • Public • Published

Bits2Bytes

Convert various units from bits to petabytes.

Installation

use npm:

Local Install :
npm install bits2bytes

Globall Install:
npm install -g bits2bytes

Using

After complete installation, you can include ./bits2bytes/index.js in your script by using var bits2bytes = require(./bits2bytes/index.js);

If you install bits2bytes globally, you can just use var bits2bytes = require('bits2bytes');

Bits2Bytes calculate all data units to each other, by just enter one unit and a value.then it return you an array or json of converted data.

For convert use convert() function.this function have tree parameters: convert(value,unit,format)

  • value: value for conversion (integer)

  • unit: unit of previous value (string - case sensitive)

    • b bite
    • B Byte
    • kb killobit
    • kB killobyte
    • mb megabit
    • mB megabyte
    • gb gigabit
    • gB gigabyte
    • tb terabit
    • tB terabyte
    • pb petabit
    • pB petabyte
  • format: format of return (string)

    • array return array of conversion.
    • json return strigify json.
      • You can return strigified json to JSON Object by using var jsonObject = JSON.parse( RETURN_VALUE )

Example

var bits2bytes = require('bis2bytes');//or if install local use require('./bits2bytes/index.js')
 
//return
console.log(bits2bytes.convert(16,'b','json'));
 
//
console.log(bits2bytes.convert(16,'b','array'));
 
//return array like above line
console.log(bits2bytes.convert(16,'b'));
 

Other apps

I previously created another platform app...if you enjoy Bits2Bytes you can use it on other platform.

Found a bug?

If you find a bug or need a feature Open a github issue.

License

MIT License ( https://opensource.org/licenses/MIT )

Package Sidebar

Install

npm i bits2bytes

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • mostafazs