{"_id":"bytes-iec","_rev":"3-b6df0025f586a6c7c8e517a2beb13e8c","name":"bytes-iec","dist-tags":{"latest":"3.1.1"},"versions":{"3.0.1":{"name":"bytes-iec","description":"(IEC) Utility to parse a string bytes to bytes and vice-versa","version":"3.0.1","author":{"name":"Saevon","email":"serghei.filippov@gmail.com"},"contributors":[{"name":"TJ Holowaychuk","email":"tj@vision-media.ca","url":"http://tjholowaychuk.com"},{"name":"Jed Watson","email":"jed.watson@me.com"},{"name":"Théo FIDRY","email":"theo.fidry@gmail.com"}],"license":"MIT","keywords":["byte","bytes","utility","parse","parser","convert","converter","iec"],"repository":{"type":"git","url":"git+https://github.com/Saevon/bytes.js.git"},"devDependencies":{"eslint":"4.19.1","mocha":"5.2.0","nyc":"11.9.0"},"engines":{"node":">= 0.8"},"scripts":{"lint":"eslint .","test":"mocha --check-leaks --reporter spec","test-ci":"nyc --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"gitHead":"e09b0077b44e52debef10a25d37dea525904d1e7","bugs":{"url":"https://github.com/Saevon/bytes.js/issues"},"homepage":"https://github.com/Saevon/bytes.js#readme","_id":"bytes-iec@3.0.1","_npmVersion":"6.4.1","_nodeVersion":"11.1.0","_npmUser":{"name":"saevon","email":"serghei.filippov@gmail.com"},"dist":{"integrity":"sha512-4+753osiJ2ihYKwd8HiuraLRUySLVd7OVSVltd4Wo4qfr67uVCwNofDceTD5BpFruCrvap2UclQ10g89aursIA==","shasum":"5703cd9555fc6d42dc48273f700a9ab1096092f6","tarball":"https://registry.npmjs.org/bytes-iec/-/bytes-iec-3.0.1.tgz","fileCount":5,"unpackedSize":19908,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4ryACRA9TVsSAnZWagAAKHMQAJ0Sh5LkULLU5h/UgIPd\n1EwZNpAQSPnOr3lbtKz0FQkJ6SgdvIncMWwQ36JRaj8ogOXL45jvKau3tEgL\nwW025XHLbEgu/rxyJNmLVLb2mKxgXSzaasr1N0AAXlhsujlu62o/Dih1ui7Y\n5KJxn6rZiOpRvV9V/KWIATOVuZaN3SXWGPJSQy7V/q/c48wgpY0K0nNqQQ8P\noonOiAT2B7BdOIffYpzLk5VY4WjG84wivczJTRe8IjxxX8ay+ex+zkHMaPDm\nEw1uNo2HisbpHXbmAxJAonqUQj0rtZ8Y97wV8SAS6MTs3OsNiWUo2t7t4o+j\n1OuWl8oEwFxBE/Gxcc09CT9qCv93+wdtJaR/uPqjsjKXeYk2BJeYqD9QbISK\nVd88QDxJmhwp1BJJq7DprwtcmXOW9axmqVLe8gL7CP9hjzgG9h20IZHxDJJX\nXNCxSB/e1ITNjCmmh3Le34GStdgkpKehLr2hXNXdnjlzKa0gK38dDQP9av4E\nDtMQghJRxbTKrLtZDe3IeOfGUnXhSlR0xwflHcvBrBQXAH7GDXlFXGHQ3JIX\nvyIZR3S0kP/8Z//0QU6D1d1Esic/LYd/KuRJQiBaYOIMY3iYQLumRaPlHi+u\nwb6aas4TzCNe6EtHItP55dTR43M6hU+I8T6WtIekJqaOH2QcezJ4PTyJ4Eib\n1xoV\r\n=7GMb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCt1tmtPPUzT0tIFThxeqQnKJKKTNjB9qjYy2fxhgfwhAIgZhecrkvcFud2bng/2QpwIf1xDl9lsxAqn4e3mznbaO0="}]},"maintainers":[{"name":"saevon","email":"serghei.filippov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bytes-iec_3.0.1_1541586048124_0.9822164939862941"},"_hasShrinkwrap":false},"3.1.0":{"name":"bytes-iec","description":"(IEC) Utility to parse a string bytes to bytes and vice-versa","version":"3.1.0","author":{"name":"Saevon","email":"serghei.filippov@gmail.com"},"contributors":[{"name":"TJ Holowaychuk","email":"tj@vision-media.ca","url":"http://tjholowaychuk.com"},{"name":"Jed Watson","email":"jed.watson@me.com"},{"name":"Théo FIDRY","email":"theo.fidry@gmail.com"}],"license":"MIT","keywords":["byte","bytes","utility","parse","parser","convert","converter","iec"],"repository":{"type":"git","url":"git+https://github.com/Saevon/bytes.js.git"},"devDependencies":{"eslint":"5.13.0","mocha":"5.2.0","nyc":"13.2.0"},"engines":{"node":">= 0.8"},"scripts":{"lint":"eslint .","test":"mocha --check-leaks --reporter spec","test-ci":"nyc --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"gitHead":"0fe8e4be5897e5355f976167018a9326de872973","bugs":{"url":"https://github.com/Saevon/bytes.js/issues"},"homepage":"https://github.com/Saevon/bytes.js#readme","_id":"bytes-iec@3.1.0","_npmVersion":"6.4.1","_nodeVersion":"11.1.0","_npmUser":{"name":"saevon","email":"serghei.filippov@gmail.com"},"dist":{"integrity":"sha512-FKhnc8ENaOrXLZlMI/OQOTqiA/FAGcu2x+eYfucPrtQ4Qj3ytjr/XO5dignErNF/xfPWCsLAz5NQFtqeSNz+Ug==","shasum":"01b23bfd1f964c1bfe9c3ceb378a868ceeb6fd6f","tarball":"https://registry.npmjs.org/bytes-iec/-/bytes-iec-3.1.0.tgz","fileCount":7,"unpackedSize":29596,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcukA9CRA9TVsSAnZWagAAF2IQAILsMRBMyWRy4jovYoGe\nZKQ0cnBgRM0lKXHLk955kmqwljONPUe6HOSBD/jT5CxmgQHwe5toElPuWBhu\nbyGKq2tNzphQveON74ET0vejlwWxN0PE8j3g1lB/6qSlWFolOGhgxOTOfEdN\nby2zIbfPXepeMhywbT5Kaz6F0t+Tm0HOx9Lfxpl9LtUYg20VAAXaMkza0BL2\nlF1G0YYvQ3ofCcofoE2E1+6MGoSna3qlg8vPs7PtbHoOGJF3Nkssz42HonV3\njEBfnVoCII7GoCLfHPjN/rgazX5e6NK0FHmGk/TpG4PJ7K5HacDJvdqQyrgX\nlmZXQ4JAC8e894l0ZOEuaV0KbNsYO73cM1a8FBVpTq4ZlffzKeDv6wtpNer6\nFcBozNfgQK4mlTHvdChFyQJVYNKuQclWUokgHuvK9IdE9ocw7jDPt4lm2ZAc\n+3jYz8aiL7hua0/HxuuLBE4rYucSYUziWfhkHuuMxpzKGCtM1C+85qSAnxDD\nWG7d1xvv7wPmO0/8CgJ3CmN62eoFpU/CXV5mYl83Bgqbnob3NHCUzVtaza/g\nI0cuiO4gysLyOrul9Vvv3I8hpubx3n+V4RyCMFZgfemzncz4XNzA/6QRU6WQ\nM5scXR9RG3J+HJfzmgt4sJQlvYEyO8wfY6ZeOVDYS6Km8AOGgzKBt/Iq7Qf3\noCpy\r\n=m+b6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBJyk0kwh51yeAK6bHNJvCq8GgoVTs3i+6/cmehGVFYkAiEAlkLRfN8jRM3wxVh6Y98o2L4lPqg/7B/EZfhpKKxwlgY="}]},"maintainers":[{"name":"saevon","email":"serghei.filippov@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bytes-iec_3.1.0_1555710012474_0.22650772996267854"},"_hasShrinkwrap":false},"3.1.1":{"name":"bytes-iec","description":"(IEC) Utility to parse a string bytes to bytes and vice-versa","version":"3.1.1","author":{"name":"Saevon","email":"serghei.filippov@gmail.com"},"contributors":[{"name":"TJ Holowaychuk","email":"tj@vision-media.ca","url":"http://tjholowaychuk.com"},{"name":"Jed Watson","email":"jed.watson@me.com"},{"name":"Théo FIDRY","email":"theo.fidry@gmail.com"}],"license":"MIT","keywords":["byte","bytes","utility","parse","parser","convert","converter","iec","si","jedec","typescript"],"repository":{"type":"git","url":"git+https://github.com/Saevon/bytes.js.git"},"devDependencies":{"@types/mocha":"8.0.4","@types/node":"14.14.10","eslint":"5.13.0","mocha":"5.2.0","nyc":"13.2.0","ts-node":"9.1.0","tsconfig-paths":"3.9.0","typescript":"4.1.2"},"engines":{"node":">= 0.8"},"scripts":{"lint":"eslint .","test":"mocha test/* --check-leaks --reporter spec --require ts-node/register --require tsconfig-paths/register","test-compat":"mocha test/*.js --check-leaks --reporter spec","test-ci":"nyc --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"gitHead":"4aace8ab8164f8ed9ca84cf3613a113b50f7f997","bugs":{"url":"https://github.com/Saevon/bytes.js/issues"},"homepage":"https://github.com/Saevon/bytes.js#readme","_id":"bytes-iec@3.1.1","_nodeVersion":"11.15.0","_npmVersion":"7.0.3","dist":{"integrity":"sha512-fey6+4jDK7TFtFg/klGSvNKJctyU7n2aQdnM+CO0ruLPbqqMOM8Tio0Pc+deqUeVKX1tL5DQep1zQ7+37aTAsA==","shasum":"94cd36bf95c2c22a82002c247df8772d1d591083","tarball":"https://registry.npmjs.org/bytes-iec/-/bytes-iec-3.1.1.tgz","fileCount":6,"unpackedSize":23062,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfz9MeCRA9TVsSAnZWagAALHYP/17thYFNbkj52AN2JHdr\nGaYkJxBaut1IKdtc8oPES5TF2eWkk4NWQHB647pYWLaA+KqaX/iRCkjODAOX\njMSYSG2RNYIFCOPvHCMoWLNLbqmsq5eyj68Ga3mwQRdTutiPlYGPtzJ2hI/P\n8+/gDdNR4FSpNLdE1Fr4SebyEVeL3U62BnSeTjF7XKYzcctIiQDGeia6f7Lk\na/BQyW7AQ+NQicebqbu2rD3RT+39GxZH+ohfVVqOwJhgfsClWMTFTvFxfEE+\nZ5fm565uLTxmPJIXf/0aQzK+5xK9vaqRgq5ehOYKTsMIwW+Ed5ZR/tGw0Z3a\n3sZDOJ5Dh86rfsd/uPS8cO75nWb0ZE7F+0QyN1Bq6AVCsIke82LX6VbcsQbn\nVMJ3R4zQqjlRfoH3cgQMTWzJprCSfN6eg90Xz4gPNubkh8K70wVg6qFP4qgB\nzb63IPeHIDwkdHvUOOVHKscCit9GFLFv+NXLVzszvjXoE8GSLlsmaTb+xcu0\nVoiyybczOtR5jTfEclYDOQwS+7iKuGWymtQgtpATLWHTm2IGPA2gkhBuJsha\nAIvyxqxClBABKa01sQt+APXupSBgR10NkpTBwO5LkMv+gVLUjspzcOePdtP+\nQIH1ZcNZotxM64DRKF36O1NXMfV5BM5TA87VG6id+18KqfOvxuPUY0p+nlaa\niS8A\r\n=6Dsp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHtq+BzP10scFKnnRyKud5pIXxJGfuUJuNzDblRDfkPoAiEApVQ7mA2vstkorFp++qhLNslj3l6a5JUVyHWzJsz1Q58="}]},"_npmUser":{"name":"saevon","email":"serghei.filippov@gmail.com"},"directories":{},"maintainers":[{"name":"saevon","email":"serghei.filippov@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bytes-iec_3.1.1_1607455517923_0.9365631853259746"},"_hasShrinkwrap":false}},"time":{"created":"2018-11-07T10:20:48.124Z","3.0.1":"2018-11-07T10:20:48.345Z","modified":"2022-04-12T04:53:47.169Z","3.1.0":"2019-04-19T21:40:12.591Z","3.1.1":"2020-12-08T19:25:18.100Z"},"maintainers":[{"name":"saevon","email":"serghei.filippov@gmail.com"}],"description":"(IEC) Utility to parse a string bytes to bytes and vice-versa","homepage":"https://github.com/Saevon/bytes.js#readme","keywords":["byte","bytes","utility","parse","parser","convert","converter","iec","si","jedec","typescript"],"repository":{"type":"git","url":"git+https://github.com/Saevon/bytes.js.git"},"contributors":[{"name":"TJ Holowaychuk","email":"tj@vision-media.ca","url":"http://tjholowaychuk.com"},{"name":"Jed Watson","email":"jed.watson@me.com"},{"name":"Théo FIDRY","email":"theo.fidry@gmail.com"}],"author":{"name":"Saevon","email":"serghei.filippov@gmail.com"},"bugs":{"url":"https://github.com/Saevon/bytes.js/issues"},"license":"MIT","readme":"# Bytes utility\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Build Status][travis-image]][travis-url]\n<!--\n[![Test Coverage][coveralls-image]][coveralls-url]\n -->\nUtility to parse a size string in bytes (e.g. `'1kB'`, `'2KiB'`) to numeric (`1000`, `2048`) and vice-versa.\n\nThis is a fork of the [bytes][bytes-url] module, except it\n\n * supports all of both the binary and decimal prefixes defined by [ISO/IEC 80000-13:2008][binary-wiki]\n * supports [JEDEC][jedec-wiki], a legacy mode in which metric units have binary values\n * uses decimal metric units by default, which can be overridden per call or by default\n\nTypeScript definitions included.\n\n## Supported Units\n\nSupported units are as follows and are case-insensitive. Note that only the abbreviation will be parsed/formatted, the full names are for the reader's understanding only.\n\n### Metric\n\nAlso referred to as SI. See [Compatibility Binary](#compatibility-binary) for legacy definitions.\n\n|      Value       | Abbr |   Name    |\n| ---------------- | ---- | --------- |\n| 1                | B    | byte      |\n| 1000<sup>1</sup> | kB   | kilobyte  |\n| 1000<sup>2</sup> | MB   | megabyte  |\n| 1000<sup>3</sup> | GB   | gigabyte  |\n| 1000<sup>4</sup> | TB   | terabyte  |\n| 1000<sup>5</sup> | PB   | petabyte  |\n| 1000<sup>6</sup> | EB   | exabyte   |\n| 1000<sup>7</sup> | ZB   | zettabyte |\n| 1000<sup>8</sup> | YB   | yottabyte |\n\n[More info][metric-wiki]\n\n### Binary\n\n|      Value       | Abbr |   Name    |\n| ---------------- | ---- | --------- |\n| 1                | B    | byte      |\n| 1024<sup>1</sup> | KiB  | kibibyte  |\n| 1024<sup>2</sup> | MiB  | mebibyte  |\n| 1024<sup>3</sup> | GiB  | gibibyte  |\n| 1024<sup>4</sup> | TiB  | tebibyte  |\n| 1024<sup>5</sup> | PiB  | pebibyte  |\n| 1024<sup>6</sup> | EiB  | exbibyte  |\n| 1024<sup>7</sup> | ZiB  | zebibite  |\n| 1024<sup>8</sup> | YiB  | yobibite  |\n\n[More info][binary-wiki]\n\n### Compatibility Binary\n\nAlso referred to as JEDEC or legacy units.\n\nOverwrites the lower units of the metric system with the commonly misused values, i.e. metric units will be binary instead of decimal.\nThis is the behavior of e.g. the Windows OS and [bytes][bytes-url].\nUnits greater than terabyte are not supported.\n\n|      Value       | Abbr |   Name    |\n| ---------------- | ---- | --------- |\n| 1024<sup>1</sup> | kB   | kilobyte  |\n| 1024<sup>2</sup> | MB   | megabyte  |\n| 1024<sup>3</sup> | GB   | gigabyte  |\n| 1024<sup>4</sup> | TB   | terabyte  |\n\n[More info][jedec-wiki]\n\n# Installation\n\nThis is a [Node.js](https://nodejs.org/en/) module available through the\n[npm registry](https://www.npmjs.com/). Installation is done using the\n[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):\n\n```bash\nnpm install bytes-iec\n```\n\n# Usage\n\n```js\nvar bytes = require('bytes-iec');\n```\n\n## Modes\n\nPassing a unit type as `mode` parameter in API calls determines\n\n * the set of units that will be favored by autodetection when no unit is specified\n * the value/size of metric units: Compatibility mode makes them base-2 instead of base-10\n\n| Unit type                                     | `mode`                         |\n| --------------------------------------------- | ------------------------------ |\n| [Metric](#metric)                             | `'metric'` or `'decimal'`      |\n| [Binary](#binary)                             | `'binary'`                     |\n| [Compatibility Binary](#compatibility-binary) | `'compatibility'` or `'jedec'` |\n\n## bytes.format(number value, [options]): string|null\n\nFormat the given value in bytes into a string. If the value is negative, it's kept as such. If it's a float, it's rounded.\n\n**Arguments**\n\n| Name    | Type     | Description        |\n|---------|----------|--------------------|\n| value   | `number` | Value in bytes     |\n| options | `Object` | Conversion options |\n\n**Options**\n\n| Property           | Type              | Description                                                                                   | Default           |\n| ------------------ | ----------------- | --------------------------------------------------------------------------------------------- | ----------------- |\n| decimalPlaces      | `number`｜`null`  | Maximum number of decimal places to include in output                                         | `2`               |\n| fixedDecimals      | `boolean`｜`null` | Whether to always display the maximum number of decimal places, i.e. preserve trailing zeroes | `false`           |\n| thousandsSeparator | `string`｜`null`  | What to separate large numbers with, e.g. `','`, `'.'`, `' '`, ...                            | `''`              |\n| unit               | `string`｜`null`  | The unit in which the result will be returned: `'B'`, `'kB'`, `'KiB'`, ...                    | `''` (autodetect) |\n| unitSeparator      | `string`｜`null`  | Separator between numeric value and unit                                                      | `''`              |\n| mode               | `string`｜`null`  | Which mode to use (see [Modes](#modes))                                                       | `'metric'`        |\n\n**Returns**\n\n| Name    | Type             | Description                                     |\n|---------|------------------|-------------------------------------------------|\n| results | `string`｜`null` | Returns null upon error, string value otherwise. |\n\n**Example**\n\n```js\nbytes(1000);\n// output: '1kB'\n\nbytes(1000, {thousandsSeparator: ' '});\n// output: '1 000B'\n\nbytes(1024);\n// output: '1.02kB'\n\nbytes(1024 * 1.7, {decimalPlaces: 0});\n// output: '2KB'\n\nbytes(1000, {unitSeparator: ' '});\n// output: '1 kB'\n\nbytes(2048, {mode: 'binary'});\n// output: '2 KiB'\n\nbytes(1024 * 1024 * 2, {unit: 'KiB'});\n// output: '2048 KiB'\n\nbytes(1024 * 1024 * 2, {unit: 'KB'});\n// output: '2097.152 KB'\n\nbytes(1024 * 1024 * 2, {unit: 'KB', mode: 'compatibility'});\n// output: '2048 KB'\n```\n\n## bytes.parse(string｜number value): number｜null\n\nParse the string value into an integer in bytes. If no unit is given, or `value`\nis a number, it is assumed the value is in bytes.\n\nIf the value given has partial bytes, it's truncated (rounded down).\n\n**Arguments**\n\n| Name          | Type   | Description        |\n|---------------|--------|--------------------|\n| value   | `string`｜`number` | String to parse, or number in bytes |\n| options | `Object` | Conversion options |\n\n|       Property       |          Type         | Description | Default |\n| -------------------- | --------------------- | ----------- |---------|\n| mode   | `string`｜`null` | Which mode to use (see [Modes](#modes)) | `'metric'` |\n\n**Returns**\n\n| Name    | Type        | Description             |\n|---------|-------------|-------------------------|\n| results | `number`｜`null` | Returns null upon error, value in bytes otherwise. |\n\n**Example**\n\n```js\nbytes('1kB');\n// output: 1024\n\nbytes('1024');\n// output: 1024\n\nbytes('1.0001 kB');\n// output: 1000\nbytes('1.0001 KiB');\n// output: 1024\n\nbytes('1kB', {mode: 'jedec'});\n// output: 1024\n```\n\n## bytes.withDefaultMode(string mode): object\n\nReturns a new copy of the `bytes-iec` module, but with the given mode as the default.\n\n**Arguments**\n\n| Name          | Type     | Description        |\n|---------------|----------|--------------------|\n| mode          | `string` | Default mode to use (see [Modes](#modes))   |\n\n**Returns**\n\n| Name    | Type        | Description             |\n|---------|-------------|-------------------------|\n| results | `object` | Returns the byte.js module, with a default mode. |\n\n**Example**\n\n```js\nvar bytes = require('bytes').withDefaultMode('jedec');\n\nbytes('1kB');\n// output: 1024\n\nbytes('1KiB');\n// output: 1024\n\nbytes(1024);\n// output: 1 kB\n\nbytes(1024, {mode: 'metric'});\n// output: 1.02kB\n\nbytes('1kB', {mode: 'metric'});\n// output: 1000\n```\n\n# License\n\n[MIT](LICENSE)\n\n<!--\n[coveralls-image]: https://badgen.net/coveralls/c/github/visionmedia/bytes.js/master\n[coveralls-url]: https://coveralls.io/r/visionmedia/bytes.js?branch=master\n-->\n\n[downloads-image]: https://badgen.net/npm/dm/bytes-iec\n[downloads-url]: https://npmjs.org/package/bytes-iec\n[npm-image]: https://badgen.net/npm/node/bytes-iec\n[npm-url]: https://npmjs.org/package/bytes-iec\n[travis-image]: https://badgen.net/travis/saevon/bytes.js/master\n[travis-url]: https://travis-ci.org/saevon/bytes.js\n[bytes-url]: https://github.com/visionmedia/bytes.js\n[binary-wiki]: https://en.wikipedia.org/wiki/Binary_prefix\n[metric-wiki]: https://en.wikipedia.org/wiki/Metric_prefix\n[jedec-wiki]: https://en.wikipedia.org/wiki/JEDEC_memory_standards#Unit_prefixes_for_semiconductor_storage_capacity\n","readmeFilename":"Readme.md"}