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โ
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| File Path Expression | Text (dynamic) | Required | Empty | Path to the field containing the file location or reference. |
Processingโ
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| Read File | Toggle (On/Off) | Optional | On | Enable to read file contents for encoding. |
| Include Metadata | Toggle (On/Off) | Optional | Off | Include file metadata (e.g., name, size, MIME type) in output. |
Outputโ
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| Option | Dropdown | Optional | Original with appended result column | Defines 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 Name | Text | Optional | "base64_result" | Column name containing the Base64-encoded output. |
๐ก Example Usageโ
๐งพ API Integrationโ
-
Configuration:
File Path Expression: Path to uploaded image filereadFile: OnincludeMetadata: OnoutTransformId: Original with appended result columnoutColumnName:"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โ
| Industry | Challenge | How Node Helps | Outcome |
|---|---|---|---|
| Healthcare | APIs require diagnostic files as Base64 text | Encodes patient scans or reports for secure transmission | Enables integration with health data APIs securely |
| Finance | Digital signatures must be submitted in Base64 format | Converts files for compliant electronic document workflows | Simplifies compliance processes, reduces manual prep |
| Marketing | Campaign automation needs inline images for emails | Encodes media assets into Base64 for embedding | Speeds campaign assembly, reduces upload errors |