Base 64 Encode
Table of Contents
Description
The zoho.encryption.base64Encode task is used to encode data to base 64 format.
Syntax
<response> = zoho.encryption.base64Encode(<data>);
where:
Params | Data type | Description |
<response> | TEXT | Specifies the response that represents the base 64 encoded data |
<data> | TEXT / FILE | Specifies the data that needs to be encoded to base 64 format |
Example 1: Encode a text to base 64 format
The following script encodes the text - john@zylker.com to base 64 format.
response = zoho.encryption.base64Encode("john@zylker.com");
where:
response
The TEXT response that represents the base 64 encoded data. This example returns - am9obkB6eWxrZXIuY29t.
"john@zylker.com"
The TEXT that represents the data that needs to be encoded
Example 2: Encode a file to base 64 format
The following script invokes a file from the web and encodes it to base 64 format.
// Fetch a file from the web sample_file = invokeUrl [ url: "http://www.africau.edu/images/default/sample.pdf" type: GET ]; // Encode the file content response = zoho.encryption.base64Encode(sample_file);
where:
response
The TEXT response that represents the base 64 encoded data
sample_file
The FILE that holds the pdf file fetched from the web that needs to be encoded