React Pretty Bytes
Convert bytes to a human readable string
1337
→1.34 kB
Try in CodeSandbox
Install
$ npm install react-pretty-bytes
Usage
; const App = <div> <PrettyBytes bytes=1337 /> </div>; // => '1.34 kB'
API
bytes={input}
Type: integer
<PrettyBytes = /> // => '1.34 kB'
option={object}
Type: object
{bits: true}
Type: boolean
Default: false
<PrettyBytes = = /> // => '1.34 kbit'
{signed: true}
Type: boolean
Default: false
<PrettyBytes = = /> // => '+42 B'
{locale: 'lang'}
Type: boolean
string
Default: false
<PrettyBytes = = /> // => '1,34 kB'
Modules used
- pretty-bytes - Convert bytes to a human readable string
License
MIT © Yohix