Skip to main content

Convert File To Base64


๐ŸŽฏ Purposeโ€‹

The ConvertFileToBase64 node converts files (such as images, PDFs, or other binary formats) into Base64-encoded strings.

This is useful when preparing files for APIs, JSON storage, or database fields that only accept text-based data. The node supports file reading, encoding, and structured data output for seamless integration in automated workflows.


โš™๏ธ Parametersโ€‹

Data Sourceโ€‹

NameTypeRequiredDefaultDescription
File Path ExpressionText (dynamic)RequiredEmptyPath to the field containing the file location or reference.

Processingโ€‹

NameTypeRequiredDefaultDescription
Read FileToggle (On/Off)OptionalOnEnable to read file contents for encoding.
Include MetadataToggle (On/Off)OptionalOffInclude file metadata (e.g., name, size, MIME type) in output.

Outputโ€‹

NameTypeRequiredDefaultDescription
OptionDropdownOptionalOriginal with appended result columnDefines output format: - Original with appended result column: Keep input data and add encoded string column. - Return result column only: Only return Base64 string.
Result Property NameTextOptional"base64_result"Column name containing the Base64-encoded output.

๐Ÿ’ก Example Usageโ€‹

๐Ÿงพ API Integrationโ€‹

  • Configuration:

    • File Path Expression: Path to uploaded image file
    • readFile: On
    • includeMetadata: On
    • outTransformId: Original with appended result column
    • outColumnName: "encoded_image"
  • Outcome: The file is read, converted into a Base64 string, and attached as a new field in the workflow output, ready for API submission.


๐Ÿ“˜ Best Practicesโ€‹

  • File Size: Avoid encoding very large files; Base64 increases data size by about 33%.
  • Validation: Confirm file existence and read permissions before encoding.
  • Security: Sanitize file paths to prevent unauthorized file access.
  • Efficiency: Cache or reuse encoded strings when repeatedly sending the same file.
  • Consistency: Match encoding and decoding nodes to maintain format integrity.

๐Ÿงช Test Casesโ€‹

  • Given: Image file at path uploads/sample.jpg โ†’ Expected: Base64 string output containing the encoded image data.
  • Given: Nonexistent file path โ†’ Expected: Error or empty output with logged warning.

๐Ÿญ Industry Applicationsโ€‹

IndustryChallengeHow Node HelpsOutcome
HealthcareAPIs require diagnostic files as Base64 textEncodes patient scans or reports for secure transmissionEnables integration with health data APIs securely
FinanceDigital signatures must be submitted in Base64 formatConverts files for compliant electronic document workflowsSimplifies compliance processes, reduces manual prep
MarketingCampaign automation needs inline images for emailsEncodes media assets into Base64 for embeddingSpeeds campaign assembly, reduces upload errors