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.
Applies to: ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Encodes a base64 string from a bytes array.
Syntax
base64_encode_fromarray(base64_string_decoded_as_a_byte_array)
Learn more about syntax conventions.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| base64_string_decoded_as_a_byte_array | dynamic |
✔️ | The bytes (integer) array to be encoded into a base64 string. |
Returns
Returns the base64 string encoded from the bytes array. Note that byte is an integer type.
Examples
The following example shows how to use base64_encode_fromarray() to encode a bytes array into a base64 string.
let bytes_array = toscalar(print base64_decode_toarray("S3VzdG8="));
print decoded_base64_string = base64_encode_fromarray(bytes_array)
Output
| decoded_base64_string |
|---|
| S3VzdG8= |
Trying to encode a base64 string from an invalid bytes array that was generated from invalid UTF-8 encoded string will return null:
let empty_bytes_array = toscalar(print base64_decode_toarray("U3RyaW5n0KHR0tGA0L7Rh9C60LA"));
print empty_string = base64_encode_fromarray(empty_bytes_array)
Output
| empty_string |
|---|
Related content
- For decoding base64 strings to a UTF-8 string, see base64_decode_tostring()
- For encoding strings to a base64 string see base64_encode_tostring()
- This function is the inverse of base64_decode_toarray()