Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In this article
Applies to: ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Formats a number as a string representing data size in bytes.
format_bytes(
size [,
precision [,
units]])
Learn more about syntax conventions.
Name | Type | Required | Description |
---|---|---|---|
size | real |
✔️ | The value to be formatted as data size in bytes. |
precision | int |
The number of digits the value will be rounded to after the decimal point. The default is 0. | |
units | string |
The units of the target data size: Bytes , KB , MB , GB , TB , PB , or EB . If this parameter is empty, the units will be auto-selected based on input value. |
A string of size formatted as data size in bytes.
print
v1 = format_bytes(564),
v2 = format_bytes(10332, 1),
v3 = format_bytes(20010332),
v4 = format_bytes(20010332, 2),
v5 = format_bytes(20010332, 0, "KB")
Output
v1 | v2 | v3 | v4 | v5 |
---|---|---|---|---|
564 Bytes | 10.1 KB | 19 MB | 19.08 MB | 19541 KB |