base64_encode_fromarray()

Applies to: ✅ Azure Data ExplorerAzure MonitorMicrosoft 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

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