JSPM

prettier-bytes

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 102052
  • Score
    100M100P100Q152454F
  • License ISC

augment pretty-bytes to make the output a little more readable (and a little less precise)

Package Exports

  • prettier-bytes

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (prettier-bytes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

prettier-bytes

npm travis standard

Augment pretty-bytes to make the output a little more readable (and a little less precise)

Differences from pretty-bytes:

  • The fractional portion is cut down to one digit
  • If there is more than one digit to the left of the decimal, the fractional portion is removed

Install

npm install prettier-bytes

Usage

var prettierBytes = require('prettier-bytes')

var pretty = prettierBytes(1337)
console.log(pretty)
// logs 1.3 kB

Examples from test output:

  pretty bytes

    ✔ bytes: 2335 -> 2.3 kB
    ✔ bytes: 23552 -> 23 kB
    ✔ bytes: 235520 -> 235 kB
    ✔ bytes: 2355520 -> 2.3 MB
    ✔ bytes: 23555520 -> 23 MB
    ✔ bytes: 235555520 -> 235 MB
    ✔ bytes: 2355555520 -> 2.3 GB
    ✔ bytes: 23555555520 -> 23 GB
    ✔ bytes: 235556555520 -> 235 GB
    ✔ bytes: 2355556655520 -> 2.3 TB
    ✔ bytes: 23555566655520 -> 23 TB
    ✔ bytes: 235555566665520 -> 235 TB

Contributing

Contributions welcome! Please read the contributing guidelines first.

License

ISC