Skip to main content

getBytes

Converts a byte value into a string that represents the byte value in the appropriate unit (e.g., KB, MB, GB, etc.).

Parameters

ParameterTypeOptionalDefaultDescription
bytesnumberfalseThe byte value to convert.

Returns

string

Example

getBytes(2048); // "2.00 KB"