{"name":"bytes","description":"Utility to parse a string bytes to bytes and vice-versa","version":"2.1.0","author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca","url":"http://tjholowaychuk.com"},"contributors":[{"name":"Jed Watson","email":"jed.watson@me.com"}],"license":"MIT","keywords":["byte","bytes","utility","parse","parser","convert","converter"],"repository":{"type":"git","url":"https://github.com/visionmedia/bytes.js"},"component":{"scripts":{"bytes/index.js":"index.js"}},"devDependencies":{"mocha":"*"},"files":["History.md","LICENSE","Readme.md","index.js"],"scripts":{"test":"mocha --check-leaks --reporter spec"},"readme":"# Bytes utility\n\nUtility to parse a string bytes (ex: `1TB`) to bytes (`1099511627776`) and vice-versa.\n\n## Usage\n\n```js\nvar bytes = require('bytes');\n```\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 is kept as such. If it is a float, it is\n 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                                                                             |\n|-------------------|--------|-----------------------------------------------------------------------------------------|\n| thousandsSeparator | `string`&#124;`null` | Example of values: `' '`, `','` and `.`... Default value to `' '`. |\n\n**Returns**\n\n| Name    | Type        | Description             |\n|---------|-------------|-------------------------|\n| results | `string`&#124;`null` | Return null upon error. String value otherwise. |\n\n**Example**\n\n```js\nbytes(1024);\n// output: '1kB'\n\nbytes(1000);\n// output: '1000B'\n\nbytes(1000, {thousandsSeparator: ' '});\n// output: '1 000B'\n```\n\n#### bytes.parse(string value): number|null\n\nParse the string value into an integer in bytes. If no unit is given, it is assumed the value is in bytes.\n\n**Arguments**\n\n| Name          | Type   | Description        |\n|---------------|--------|--------------------|\n| value   | `string` | String to parse.   |\n\n**Returns**\n\n| Name    | Type        | Description             |\n|---------|-------------|-------------------------|\n| results | `number`&#124;`null` | Return 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```\n\n## Installation\n\n```bash\nnpm install bytes --save\ncomponent install visionmedia/bytes.js\n```\n\n## License \n\n[![npm](https://img.shields.io/npm/l/express.svg)](https://github.com/visionmedia/bytes.js/blob/master/LICENSE)\n","readmeFilename":"Readme.md","bugs":{"url":"https://github.com/visionmedia/bytes.js/issues"},"homepage":"https://github.com/visionmedia/bytes.js","_id":"bytes@2.1.0","_shasum":"ac93c410e2ffc9cc7cf4b464b38289067f5e47b4","_from":"https://registry.npmjs.org/bytes/-/bytes-2.1.0.tgz","_resolved":"https://registry.npmjs.org/bytes/-/bytes-2.1.0.tgz"}