Minima.js API / @minimajs/multipart / helpers / humanFileSize
Function: humanFileSize()
ts
function humanFileSize(bytes, dp): string;Defined in: packages/multipart/src/helpers.ts:34
Converts a byte count into a human-readable file size string with binary units.
Parameters
bytes
number
dp
number = 1
Returns
string
Example
ts
humanFileSize(1024); // "1.0 KiB"
humanFileSize(1536, 2); // "1.50 KiB"
humanFileSize(5242880); // "5.0 MiB"