human-readable-bytes
v1.1.0
Published
Convert bytes to a readable format (GB, MB, etc.)
Downloads
168
Readme
Human Readable Bytes
Convert bytes to a readable format (GB, MB, etc.)
Installation
npm install human-readable-bytes --save
; oryarn add human-readable-bytes
.
Usage
import convertBytesToHumanReadable from 'human-readable-bytes'
convertBytesToHumanReadable(bytes, method, decimals, space)
Options
| Param | Description | Valid Options|
| ------ | ---------------- | ------------------------------------- |
| bytes
| The bytes to convert | String/Integer|
| method
| File size calculation type | 1000 or 1024|
| decimals
| Decimals to add to the file size | Integer |
| space
| Add a space between file size and text (40GB vs. 40 GB) | Boolean |