Base64 Decode file
Okay, here's the documentation page for the "Base64 Decode file" function, tailored for business users and citizen developers.
Function: Base64 Decode file
This function allows you to convert a Base64 encoded text string back into its original file format. This is useful when you receive file content as a long string of characters (Base64) and need to reconstruct it into a usable file, such as an image, document, or PDF. The platform will automatically detect the file type (e.g., PNG, PDF, TXT) and create a new file variable that you can then use in other actions within your application.
Input
- Base64 (Text, Required): This is the long string of characters that represents the content of the file you want to decode. You might receive this string from an external system, an API response, or a database field.
- Filename (Text, Required): This is the name you want to give to the new file, including its file extension. For example, if you're decoding a PDF document, you might enter
invoice.pdf. If it's an image, you could useprofile_picture.jpg.
Output
- Result (File): A variable that will hold the newly created file. This variable contains the decoded file, which can then be used in subsequent actions, such as saving it to your platform's storage, attaching it to an email, or displaying it in your application. By default, this variable is named
RESULT.
Execution Flow
Here's a visual representation of how the "Base64 Decode file" function works:
Real-Life Examples
Here are a few scenarios demonstrating how you can use the "Base64 Decode file" function:
-
Saving an Image from an API Response:
- Scenario: You're building an application that integrates with an external image processing service. This service returns the processed image as a Base64 encoded string. You need to convert this string back into an actual image file and save it to your platform's file storage.
- Inputs:
- Base64: (A variable containing the Base64 string received from the API, e.g.,
apiResponse.processedImageBase64) - Filename:
user_profile_photo.png
- Base64: (A variable containing the Base64 string received from the API, e.g.,
- Result: A new image file named
user_profile_photo.pngis created and stored in theRESULTvariable. You can then use another action to upload thisRESULTfile to your cloud storage.
-
Extracting a Document from a Database Record:
- Scenario: Your customer database stores small document attachments (like signed contracts or invoices) as Base64 strings within a text field to keep them directly linked to the customer record. You need to retrieve a specific contract and allow your users to download it.
- Inputs:
- Base64: (A variable containing the Base64 string retrieved from the database, e.g.,
customerRecord.contractData) - Filename:
customer_contract_2023.pdf
- Base64: (A variable containing the Base64 string retrieved from the database, e.g.,
- Result: A new PDF file named
customer_contract_2023.pdfis created and stored in theRESULTvariable. ThisRESULTfile can then be provided as a download link to your users.
-
Generating a Dynamic Report for Email Attachment:
- Scenario: Your application generates a daily sales report as a Base64 encoded CSV string. You want to attach this report as a
.csvfile to an automated email sent to your sales team. - Inputs:
- Base64: (A variable containing the Base64 string of the generated report, e.g.,
generatedReport.csvBase64) - Filename:
sales_report_today.csv
- Base64: (A variable containing the Base64 string of the generated report, e.g.,
- Result: A new CSV file named
sales_report_today.csvis created and stored in theRESULTvariable. You can then use an "Send Email" action and attach theRESULTfile to it.
- Scenario: Your application generates a daily sales report as a Base64 encoded CSV string. You want to attach this report as a