Returns a human readable representation of a (file) size.

Syntax

Smartsite SXML CopyCode image Copy Code
string string.formatsize(float size)
string string.formatsize(float size, enum unit)
string string.formatsize(float size, enum unit, string locale)

Parameters

Name Data Type Description
size Float The size.
unit Enum The unit.
Enum values:
  • Automatic
    Automatically detect best unit
  • Bytes
    Display size in bytes
  • KiloBytes
    Display size in kilobytes
  • MegaBytes
    Display size in megabytes
  • GigaBytes
    Display size in gigabytes
  • TeraBytes
    Display size in terabytes
  • PetaBytes
    Display size in petabytes
  • ExaBytes
    Display size in exabytes
locale String The locale.

Return Value

Data Type Description
String String representation of the (file) size, using B/kB/MB/GB notation (e.g. "11.96 MB").

Expand image Examples

SXML