JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2076880
  • Score
    100M100P100Q197502F
  • License MIT

Convert a value in bytes to a more human-readable size.

Package Exports

  • byte-size

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 (byte-size) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

view on npm npm module downloads per month Build Status Dependency Status

byte-size

Convert a value in bytes to a more human-readable size.

byteSize(bytes, [precision]) ⇒ string

Kind: Exported function

Param Type Default Description
bytes number the bytes value to convert
[precision] number 0 number of decimal places

Example

> var byteSize = require("byte-size");

> byteSize(10000)
'10 KB'

> byteSize(10000, 1)
'9.8 KB'

> byteSize(10000, 2)
'9.77 KB'

> byteSize(10000, 3)
'9.766 KB'

> byteSize(1234000, 2)
'1.18 MB'

> byteSize(32432434000, 2)
'30.21 GB'

> byteSize(324324342354360, 2)
'294.97 TB'

© 2015 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.