Function: base64.encode

Encodes given bytes to Base64 text.

Arguments

Arguments
data

bytes

The input to be encoded.

padding

boolean

Specifies whether padding characters should be used to align the output to a multiple of 4 bytes (default: true).

Returns

The encoded Base64 output, as a string.

Examples

For more information, see Returning bytes.

# Encode message to JSON bytes, then encode bytes to Base64 text - init:  assign:  - project: '${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}'  - topic: TOPIC_ID  - message:  hello: world  - base64Msg: '${base64.encode(json.encode(message))}' - publish_message_to_topic: # publishes message to Pub/Sub topic  call: googleapis.pubsub.v1.projects.topics.publish  args:  topic: '${"projects/" + project + "/topics/" + topic}'  body:  messages:  - data: '${base64Msg}'