{"_id":"@cjser/pretty-bytes__v6_1_1","name":"@cjser/pretty-bytes__v6_1_1","dist-tags":{"latest":"6.1.1-cjser.2"},"versions":{"6.1.1-cjser.2":{"name":"@cjser/pretty-bytes__v6_1_1","version":"6.1.1-cjser.2","description":"Convert bytes to a human readable string: 1337 → 1.34 kB","license":"MIT","repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"require":"./dist-cjser/index.cjs","default":"./index.js"},"types":"./index.d.ts","engines":{"node":"^14.13.1 || >=16.0.0"},"scripts":{"test":"xo && ava && tsd"},"keywords":["pretty","bytes","byte","filesize","size","file","human","humanized","readable","si","data","locale","localization","localized"],"devDependencies":{"ava":"^4.0.1","tsd":"^0.19.1","xo":"^0.54.0"},"main":"./dist-cjser/index.cjs","cjser":{"sourceVersion":"6.1.1","cjserVersion":2,"original":{"name":"pretty-bytes","version":"6.1.1","exports":"./index.js","repository":"sindresorhus/pretty-bytes","files":["index.js","index.d.ts"],"scripts":{"test":"xo && ava && tsd"}}},"_id":"@cjser/pretty-bytes__v6_1_1@6.1.1-cjser.2","gitHead":"a4bef54d7d22d3d9a6b84528457938d84cd65fe7","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-D2AeyqaRZD1iBrPm/eOiud6eHKXfOSsy9NfMTeeI11DnbQ+eAjR6aRQey9YRbkdKHPQYlvJHZoU27Tr6DnUD0w==","shasum":"c7f3ff2dc8d908897e1ead1ebf78f6ef5c8ca147","tarball":"https://registry.npmjs.org/@cjser/pretty-bytes__v6_1_1/-/pretty-bytes__v6_1_1-6.1.1-cjser.2.tgz","fileCount":6,"unpackedSize":15550,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD0jDF2MDDTPm0BB0GBfTOx8jzOLQML2wrrHMHmvq+c9wIhAMe81knKa7mzWvnFSRINf7LAT4iepJwcql7OpOWLufdq"}]},"_npmUser":{"name":"nanahira","email":"nanahira@momobako.com"},"directories":{},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pretty-bytes__v6_1_1_6.1.1-cjser.2_1778159653050_0.31181005101451986"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-07T13:14:12.972Z","6.1.1-cjser.2":"2026-05-07T13:14:13.237Z","modified":"2026-05-07T13:14:13.402Z"},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"description":"Convert bytes to a human readable string: 1337 → 1.34 kB","keywords":["pretty","bytes","byte","filesize","size","file","human","humanized","readable","si","data","locale","localization","localized"],"repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT","readme":"# pretty-bytes\n\n> Convert bytes to a human readable string: `1337` → `1.34 kB`\n\nUseful for displaying file sizes for humans.\n\n*Note that it uses base-10 (e.g. kilobyte).\n[Read about the difference between kilobyte and kibibyte.](https://web.archive.org/web/20150324153922/https://pacoup.com/2009/05/26/kb-kb-kib-whats-up-with-that/)*\n\n## Install\n\n```sh\nnpm install pretty-bytes\n```\n\n## Usage\n\n```js\nimport prettyBytes from 'pretty-bytes';\n\nprettyBytes(1337);\n//=> '1.34 kB'\n\nprettyBytes(100);\n//=> '100 B'\n\n// Display with units of bits\nprettyBytes(1337, {bits: true});\n//=> '1.34 kbit'\n\n// Display file size differences\nprettyBytes(42, {signed: true});\n//=> '+42 B'\n\n// Localized output using German locale\nprettyBytes(1337, {locale: 'de'});\n//=> '1,34 kB'\n```\n\n## API\n\n### prettyBytes(number, options?)\n\n#### number\n\nType: `number`\n\nThe number to format.\n\n#### options\n\nType: `object`\n\n##### signed\n\nType: `boolean`\\\nDefault: `false`\n\nInclude plus sign for positive numbers. If the difference is exactly zero a space character will be prepended instead for better alignment.\n\n##### bits\n\nType: `boolean`\\\nDefault: `false`\n\nFormat the number as [bits](https://en.wikipedia.org/wiki/Bit) instead of [bytes](https://en.wikipedia.org/wiki/Byte). This can be useful when, for example, referring to [bit rate](https://en.wikipedia.org/wiki/Bit_rate).\n\n##### binary\n\nType: `boolean`\\\nDefault: `false`\n\nFormat the number using the [Binary Prefix](https://en.wikipedia.org/wiki/Binary_prefix) instead of the [SI Prefix](https://en.wikipedia.org/wiki/SI_prefix). This can be useful for presenting memory amounts. However, this should not be used for presenting file sizes.\n\n##### locale\n\nType: `boolean | string`\\\nDefault: `false` *(No localization)*\n\n**Important:** Only the number and decimal separator are localized. The unit title is not and will not be localized.\n\n- If `true`: Localize the output using the system/browser locale.\n- If `string`: Expects a [BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) (For example: `en`, `de`, …)\n- If `string[]`: Expects a list of [BCP 47 language tags](https://en.wikipedia.org/wiki/IETF_language_tag) (For example: `en`, `de`, …)\n\n##### minimumFractionDigits\n\nType: `number`\\\nDefault: `undefined`\n\nThe minimum number of fraction digits to display.\n\nIf neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.\n\n```js\nimport prettyBytes from 'pretty-bytes';\n\n// Show the number with at least 3 fractional digits\nprettyBytes(1900, {minimumFractionDigits: 3});\n//=> '1.900 kB'\n\nprettyBytes(1900);\n//=> '1.9 kB'\n```\n\n##### maximumFractionDigits\n\nType: `number`\\\nDefault: `undefined`\n\nThe maximum number of fraction digits to display.\n\nIf neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.\n\n```js\nimport prettyBytes from 'pretty-bytes';\n\n// Show the number with at most 1 fractional digit\nprettyBytes(1920, {maximumFractionDigits: 1});\n//=> '1.9 kB'\n\nprettyBytes(1920);\n//=> '1.92 kB'\n```\n\n##### space\n\nType: `boolean`\\\nDefault: `true`\n\nPut a space between the number and unit.\n\n```js\nimport prettyBytes from 'pretty-bytes';\n\nprettyBytes(1920, {space: false});\n//=> '1.9kB'\n\nprettyBytes(1920);\n//=> '1.92 kB'\n```\n\n## Related\n\n- [pretty-bytes-cli](https://github.com/sindresorhus/pretty-bytes-cli) - CLI for this module\n- [pretty-ms](https://github.com/sindresorhus/pretty-ms) - Convert milliseconds to a human readable string\n\n## cjser\n\nThis package is a CommonJS-compatible build generated by cjser for projects that still need `require()` support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.\nOriginal repository: https://github.com/sindresorhus/pretty-bytes\n","readmeFilename":"readme.md","_rev":"1-fc4b5a65e80b0dc15a121b62c5ea9caf"}