{
"_from": "byte-size@5.0.1",
"_id": "byte-size@5.0.1",
"_inBundle": false,
"_integrity": "sha512-/XuKeqWocKsYa/cBY1YbSJSWWqTi4cFgr9S6OyM7PBaPbr9zvNGwWP33vt0uqGhwDdN+y3yhbXVILEUpnwEWGw==",
"_location": "/npm/byte-size",
"_phantomChildren": {},
"_requested": {
"escapedName": "byte-size",
"fetchSpec": "5.0.1",
"name": "byte-size",
"raw": "byte-size@5.0.1",
"rawSpec": "5.0.1",
"registry": true,
"saveSpec": null,
"type": "version"
},
"_requiredBy": [
"#USER",
"/npm"
],
"_resolved": "https://registry.npmjs.org/byte-size/-/byte-size-5.0.1.tgz",
"_shasum": "4b651039a5ecd96767e71a3d7ed380e48bed4191",
"_shrinkwrap": null,
"_spec": "byte-size@5.0.1",
"_where": "/Users/aeschright/code/cli",
"author": {
"email": "75pound@gmail.com",
"name": "Lloyd Brookes"
},
"bugs": {
"url": "https://github.com/75lb/byte-size/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Raul Perez",
"email": "repejota@gmail.com",
"url": "http://repejota.com"
}
],
"dependencies": {},
"deprecated": false,
"description": "Convert a bytes (and octets) value to a more human-readable format. Choose between metric or IEC units.",
"devDependencies": {
"coveralls": "^3.0.2",
"jsdoc-to-markdown": "^4.0.1",
"rollup": "^0.68.1",
"test-runner": "^0.5.1"
},
"engines": {
"node": ">=6.0.0"
},
"files": [
"dist/index.js",
"index.mjs"
],
"homepage": "https://github.com/75lb/byte-size#readme",
"keywords": [
"IEC",
"bytes",
"convert",
"human",
"metric",
"octet",
"readable",
"size"
],
"license": "MIT",
"main": "dist/index.js",
"name": "byte-size",
"optionalDependencies": {},
"readme": "[](https://www.npmjs.org/package/byte-size)\n[](https://www.npmjs.org/package/byte-size)\n[](https://travis-ci.org/75lb/byte-size)\n[](https://coveralls.io/github/75lb/byte-size?branch=master)\n[](https://david-dm.org/75lb/byte-size)\n[](https://github.com/feross/standard)\n\n<a name=\"module_byte-size\"></a>\n\n## byte-size\nAn isomorphic, load-anywhere function to convert a bytes value into a more human-readable format. Choose between [metric or IEC units](https://en.wikipedia.org/wiki/Gigabyte), summarised below.\n\nValue | Metric\n----- | -------------\n1000 | kB kilobyte\n1000^2 | MB megabyte\n1000^3 | GB gigabyte\n1000^4 | TB terabyte\n1000^5 | PB petabyte\n1000^6 | EB exabyte\n1000^7 | ZB zettabyte\n1000^8 | YB yottabyte\n\nValue | IEC\n----- | ------------\n1024 | KiB kibibyte\n1024^2 | MiB mebibyte\n1024^3 | GiB gibibyte\n1024^4 | TiB tebibyte\n1024^5 | PiB pebibyte\n1024^6 | EiB exbibyte\n1024^7 | ZiB zebibyte\n1024^8 | YiB yobibyte\n\nValue | Metric (octet)\n----- | -------------\n1000 | ko kilooctet\n1000^2 | Mo megaoctet\n1000^3 | Go gigaoctet\n1000^4 | To teraoctet\n1000^5 | Po petaoctet\n1000^6 | Eo exaoctet\n1000^7 | Zo zettaoctet\n1000^8 | Yo yottaoctet\n\nValue | IEC (octet)\n----- | ------------\n1024 | Kio kilooctet\n1024^2 | Mio mebioctet\n1024^3 | Gio gibioctet\n1024^4 | Tio tebioctet\n1024^5 | Pio pebioctet\n1024^6 | Eio exbioctet\n1024^7 | Zio zebioctet\n1024^8 | Yio yobioctet\n\n**Example** \n```js\nconst byteSize = require('byte-size')\n```\n<a name=\"exp_module_byte-size--byteSize\"></a>\n\n### byteSize(bytes, [options]) ⇒ <code>Object</code> ⏏\n**Kind**: Exported function \n\n| Param | Type | Default | Description |\n| --- | --- | --- | --- |\n| bytes | <code>number</code> | | the bytes value to convert. |\n| [options] | <code>object</code> | | optional config. |\n| [options.precision] | <code>number</code> | <code>1</code> | number of decimal places. |\n| [options.units] | <code>string</code> | <code>"metric"</code> | select `'metric'`, `'iec'`, `'metric_octet'` or `'iec_octet'` units. |\n\n**Example** \n```js\n> const byteSize = require('byte-size')\n\n> byteSize(1580)\n{ value: '1.6', unit: 'kB' }\n\n> byteSize(1580, { units: 'iec' })\n{ value: '1.5', unit: 'KiB' }\n\n> byteSize(1580, { units: 'iec', precision: 3 })\n{ value: '1.543', unit: 'KiB' }\n\n> byteSize(1580, { units: 'iec', precision: 0 })\n{ value: '2', unit: 'KiB' }\n\n> byteSize(1580, { units: 'metric_octet' })\n{ value: '1.6', unit: 'ko' }\n\n> byteSize(1580, { units: 'iec_octet' })\n{ value: '1.5', unit: 'Kio' }\n\n> byteSize(1580, { units: 'iec_octet' }).toString()\n'1.5 Kio'\n\n> const { value, unit } = byteSize(1580, { units: 'iec_octet' })\n> `${value} ${unit}`\n'1.5 Kio'\n```\n\n### Load anywhere\n\nThis library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.\n\nNode.js:\n\n```js\nconst byteSize = require('byte-size')\n```\n\nWithin Node.js with ECMAScript Module support enabled:\n\n```js\nimport byteSize from 'byte-size'\n```\n\nWithin a modern browser ECMAScript Module:\n\n```js\nimport byteSize from './node_modules/byte-size/index.mjs'\n```\n\nOld browser (adds `window.byteSize`):\n\n```html\n<script nomodule src=\"./node_modules/byte-size/dist/index.js\"></script>\n```\n\n* * *\n\n© 2014-18 Lloyd Brookes \\<75pound@gmail.com\\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git+https://github.com/75lb/byte-size.git"
},
"scripts": {
"cover": "istanbul cover ./node_modules/.bin/test-runner test.js && cat coverage/lcov.info | ./node_modules/.bin/coveralls",
"dist": "rollup -c dist/index.config.js",
"docs": "jsdoc2md -t README.hbs dist/index.js > README.md; echo",
"test": "npm run test:js && npm run test:mjs",
"test:js": "rollup -c dist/test.config.js && node dist/test.js",
"test:mjs": "node --experimental-modules test/test.mjs"
},
"version": "5.0.1"
}