Function: formatFileSize()
ts
function formatFileSize(
bytes,
decimals?,
binary?): string;Formats byte size (binary units by default). 文件大小格式化(默认二进制单位)。
Parameters
| Parameter | Type | Default value |
|---|---|---|
bytes | number | undefined |
decimals | number | 2 |
binary | boolean | true |
Returns
string
Example
ts
formatFileSize(1048576) // => '1.00 MB'Since
1.0.0