Data Converter icon

Data Converter

Convert between various data formats - Base64, Binary, JSON, XML, YAML, CSV, HTML, and more

Overview

The node provides a "Data Converter" tool that supports multiple data format conversions. Specifically, for the Base64 resource with the Create Data URL operation, it creates a data URL string from given content and a specified MIME type. This is useful when you want to embed small files (like images or fonts) directly into HTML or CSS by encoding them as data URLs.

Common scenarios:

  • Embedding an image or icon directly in a web page without separate file requests.
  • Generating inline styles or scripts that include encoded resources.
  • Creating data URLs for use in emails or other contexts where external file references are not feasible.

Example:

  • Input: Raw Base64-encoded image data and MIME type image/png.
  • Output: A data URL string like data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA....

Properties

Name Meaning
MIME Type The MIME type to assign to the generated data URL (e.g., image/png, text/plain).
Binary Property Name When outputting binary data, this is the name of the binary property in the output item.

Output

  • The output JSON contains a single field holding the generated data URL string.
  • If configured to output binary data (not typical for this operation), the binary property will contain the corresponding binary data under the specified property name.
  • The data URL string follows the standard format: data:[<MIME-type>][;base64],<data>.

Dependencies

  • No external services or API keys are required.
  • The node relies on internal utility functions for Base64 encoding and data URL creation.
  • No special environment variables or n8n configurations are necessary.

Troubleshooting

  • Empty or invalid input data: Ensure the input data string is correctly Base64-encoded or raw data as expected.
  • Incorrect MIME type: Using an incorrect MIME type may cause browsers or clients to misinterpret the data URL.
  • Output binary option confusion: The "Binary Property Name" only applies if the node is set to output binary data; otherwise, the output is a JSON string.
  • Error messages: Errors typically indicate invalid input data or parameter issues. Verify all required parameters are provided and valid.

Links and References

Discussion