1.0.3 • Published 4 years ago

react-pretty-bytes v1.0.3

Weekly downloads
69
License
MIT
Repository
github
Last release
4 years ago

React Pretty Bytes

Convert bytes to a human readable string 13371.34 kB

CI Version Downloads Install size

NPM

Try in CodeSandbox

Edit react-camelcase

Install

$ npm install react-pretty-bytes

Usage

import PrettyBytes from 'react-pretty-bytes';

const App = () => (
  <div>
    <PrettyBytes bytes={1337} />
  </div>
);

// => '1.34 kB'

API

bytes={input}

Type: integer

<PrettyBytes bytes={1337} />

// => '1.34 kB'

option={object}

Type: object

{bits: true}

Type: boolean Default: false

<PrettyBytes bytes={1337} option={{bits: true}} />

// => '1.34 kbit'

{signed: true}

Type: boolean Default: false

<PrettyBytes bytes={1337} option={{signed: true}} />

// => '+42 B'

{locale: 'lang'}

Type: boolean string Default: false

<PrettyBytes bytes={1337} option={{locale: 'de'}} />

// => '1,34 kB'

Modules used

License

MIT © Yohix