react-pretty-bytes

1.0.3 • Public • Published

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

Package Sidebar

Install

npm i react-pretty-bytes

Weekly Downloads

315

Version

1.0.3

License

MIT

Unpacked Size

18.4 kB

Total Files

5

Last publish

Collaborators

  • yohix