Choose where you’d like to start

Base 64 Decode To File

Description

The zoho.encryption.base64DecodeToFile task is used to decode text that is encoded in base 64 format, and convert the decoded content to a file.

Syntax

<response> = zoho.encryption.base64DecodeToFile(<encoded_text>,<file_name>);

where,

ParamsData typeDescription

<response>

FILE

Specifies the response that represents the file object that contains the decoded data

<encoded_text>

TEXT

Specifies the base 64 encoded text that needs to be decoded

Note: 
  • In Zoho Creator, the input encoded text cannot be more than 50 MB.
  • In services other than Zoho Creator, the input encoded text cannot be more than 25 MB.

<file_name>

TEXT

Specifies the name of the file that needs to be created

Example 1

The following script decodes the base 64 encoded text - U3Vuc2hpbmU= and converts it to a file with name - Sample File.

response = zoho.encryption.base64DecodeToFile("U3Vuc2hpbmU=","Sample File");

where:

response
The FILE response that contains decoded data
"U3Vuc2hpbmU="
The TEXT that represents the base 64 encoded text that needs to be decoded and converted to a file
"Sample File"
The TEXT that represents the name of the file that needs to be created

Example 2

The following script encodes a file fetched from the web and decodes it back to restore the original content as a file object.

 //Fetch a file from the web using invokeUrl task
 sample_file = invokeUrl
 [
 url: "http://www.africau.edu/images/default/sample.pdf"
 type: GET
 ];
 
 //Encode the file content
 text_to_decode = zoho.encryption.base64Encode(sample_file);
 
 //Decode the encoded content and restore it back to a file
 response = zoho.encryption.base64DecodeToFile(text_to_decode,"Sample File");

where:

response
The FILE response that contains decoded data
text_to_decode
The TEXT variable that holds the encoded text

Related Links

Get Started Now

Execute