bits2bytes v1.0.0
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
biteB
Bytekb
killobitkB
killobytemb
megabitmB
megabytegb
gigabitgB
gigabytetb
terabittB
terabytepb
petabitpB
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.
- Firefox Addon
- Wordpress Plugin
- You can convert Bits2Bytes for using on browser with Browserify.
browserify index.js -o browseify_bits2bytes.js
Found a bug?
If you find a bug or need a feature Open a github issue.
License
MIT License ( https://opensource.org/licenses/MIT )
8 years ago