Ask AI
Skip to main content

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 use profile_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:

  1. 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
    • Result: A new image file named user_profile_photo.png is created and stored in the RESULT variable. You can then use another action to upload this RESULT file to your cloud storage.
  2. 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
    • Result: A new PDF file named customer_contract_2023.pdf is created and stored in the RESULT variable. This RESULT file can then be provided as a download link to your users.
  3. 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 .csv file 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
    • Result: A new CSV file named sales_report_today.csv is created and stored in the RESULT variable. You can then use an "Send Email" action and attach the RESULT file to it.