require("js-whatever/js/memory-format")(bytes, multiple) → {string}
Formats a number of bytes to one decimal place in the largest available unit
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
bytes |
number | The number of bytes to format |
|
multiple |
number |
<optional> |
The number of bytes will be multiplied by this before being formatted. Useful if |
- Source:
Returns:
A formatted string
- Type
- string
Example
memoryFormat(10); // returns '10 B' memoryFormat(1024); // returns '1.0 KB' memoryFormat(2, 1024); // returns '2.0 KB'
- Source: