JSPM

pretty-file-size

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q9909F
  • License MIT

Package Exports

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

Readme

Pretty File Size

A tiny file-size formatter, with no dependencies.

It's based on the SI definition of file sizes, so 1 kB = 1024 B

Install

# yarn
yarn add pretty-file-size

# npm
npm install --save pretty-file-size

Usage

import formatFileSize from 'pretty-file-size';

prettyFileSize(34892075);
// > 33.3 MB

prettyFileSize(245)).toEqual('245 B')

API

prettyFileSize(size: number, points: number)

size: number

The number of bytes.

points: number

The number of decimal points.

Default: 1

License

MIT © Tobias Herber