Convert Base64 to File
Verb: base64ToFile
Available from: <Standard>
Converts text in "Base64" format to a file.
Base64 encoding is a process of converting binary data to an ASCII string format, converting this binary data into a 6-bit character representation.
Syntax
base64ToFile --text(String) [--createrandomfile(Boolean)] --filepath(String) [--fileSystem(FileSystem)] (String)=value
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--text | Text | Required | Text | Text in Base64 format to be converted to file. |
--createrandomfile | Create Random File | Optional | Boolean | When enabled, creates a new random file in which to save the converted content.
The random file created is a ".txt". |
--filepath | File Path | Only whenCreate Random File is False | Text | Full path to save the file after conversion.
If the file to be converted is not a text file, enter the appropriate name and extension. |
--fileSystem | File System | Optional | File System | Connection variable to a file system.
1. To obtain the connection variable with an available file system, this connection must be established using one of the following commands: IBM RPA Control Center. 2. If nothing is specified in this parameter, the local file system of the operating system is used as default. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
value | File Path | Text | File path of the converted content. |
Example
Example 1: The Convert Base64 to File command converts text to "Base64" format and stores it in a file named "base64".
defVar --name textBase64 --type String --value "V0RHIEF1dG9tYXRpb24="
defVar --name convertedFilePath --type String
defVar --name documentsPath --type String
getSpecialFolder --folder "MyDocuments" documentsPath=value
// Create or overwrite a document named "base64" within "Documents" on the user's machine, writing the conversion to it.
base64ToFile --text "${textBase64}" --filepath "${documentsPath}\\base64.txt" convertedFilePath=value
logMessage --message "${convertedFilePath}" --type "Info"
// Returns the full path to the converted file.
Example 2: The Convert Base64 to File command converts text to "Base64" format and stores it in a file that is randomly created on the user's device.
defVar --name textBase64 --type String --value "V0RHIEF1dG9tYXRpb24="
defVar --name convertedFilePath --type String
base64ToFile --text "${textBase64}" --createrandomfile convertedFilePath=value
logMessage --message "${convertedFilePath}" --type "Info"
// Returns the full path to the converted file.