fileSizeUnit

fileSizeUnit function formats a file size (in bytes) into a human-readable string with appropriate units (kB, MB, etc.).

Example

Params
paramDescriptionTypeDefault
bytesThe file size in bytes.number-
siDetermines whether to use SI units (base 1000) or binary units (base 1024).boolean-
dpThe number of decimal places to include in the formatted output.number-
Params
returnDescriptionTypeDefault
resultThe formatted file size with the appropriate unit, based on the number of bytes.string-