1.0.3 • Published 6 years ago
react-pretty-bytes v1.0.3
React Pretty Bytes
Convert bytes to a human readable string
1337→1.34 kB
Try in CodeSandbox
Install
$ npm install react-pretty-bytesUsage
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
- pretty-bytes - Convert bytes to a human readable string
 
License
MIT © Yohix
