base64_encode_fromarray()
Applies to: ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Encodes a base64 string from a bytes array.
base64_encode_fromarray(
base64_string_decoded_as_a_byte_array)
Learn more about syntax conventions.
Name | Type | Required | Description |
---|---|---|---|
base64_string_decoded_as_a_byte_array | dynamic |
✔️ | The bytes (integer) array to be encoded into a base64 string. |
Returns the base64 string encoded from the bytes array. Note that byte is an integer type.
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 |
---|
- 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()