binary-prefix
v1.1.1
Published
Return a list of binary or decimal SI unit prefixes.
Downloads
34
Maintainers
Readme
Binary-Prefix
A Javascript library for retrieveing a list of binary or decimal SI unit prefixes
Install
$ npm install --save binary-prefix
Usage
var prefixes = require('binary-prefix');
prefixes.binary;
//=> {
//=> B: 'B',
//=> KB: 'KB',
//=> MB: 'MB',
//=> GB: 'GB',
//=> TB: 'TB',
//=> PB: 'PB',
//=> EB: 'EB',
//=> ZB: 'ZB',
//=> YB: 'YB'
//=> }
prefixes();
//=> {
//=> B: 'B',
//=> KB: 'KB',
//=> MB: 'MB',
//=> GB: 'GB',
//=> TB: 'TB',
//=> PB: 'PB',
//=> EB: 'EB',
//=> ZB: 'ZB',
//=> YB: 'YB'
//=> }
// Getting a list of decimal prefixes
prefixes.decimal;
//=> {
//=> B: 'B',
//=> KB: 'kB',
//=> MB: 'MB',
//=> GB: 'GB',
//=> TB: 'TB',
//=> PB: 'PB',
//=> EB: 'EB',
//=> ZB: 'ZB',
//=> YB: 'YB'
//=> }
prefixes({ decimal: true });
//=> {
//=> B: 'B',
//=> KB: 'kB',
//=> MB: 'MB',
//=> GB: 'GB',
//=> TB: 'TB',
//=> PB: 'PB',
//=> EB: 'EB',
//=> ZB: 'ZB',
//=> YB: 'YB'
//=> }
// Using custom prefixes
prefixes({ custom: { KB: 'kilobytes', GB: 'gigga-bytes' } });
//=> {
//=> B: 'B',
//=> KB: 'kilobytes',
//=> MB: 'MB',
//=> GB: 'gigga-bytes',
//=> TB: 'TB',
//=> PB: 'PB',
//=> EB: 'EB',
//=> ZB: 'ZB',
//=> YB: 'YB'
//=> }
License
MIT © Andrew Kennedy