Can not figure out binary files processing and data url links

Hi. I am trying to use n8n to process messages I forward to Telegram channel.

Every time Trigger node fires it saves the image attached and then i want to forward it to API.
API wants me to attach files in Data URL format.

In my test setup I have an HTTPrequest node presenting an image as binary.

If I click “view” button and then select “Copy image URL” browser option I get exact link I need (data:image/png;base64,iVBORw0KGgoAAAANSUhEUg… etc)

But I do not understand how to pass this as a string to the next node.

Hi @io_io, I am not sure I fully understand your current status.

So you are receiving binary data in your HTTP Request node, but want a base64-encoded string instead? You could use the Move Binary Data node for this, like so:

This would provide you with a string in the data field:

You can then use a Set node to add a prefix such as data:image/png;base64, if needed:

Quickly double-checking this using Base64 to File | Base64 Decode | Base64 Converter | Base64 suggests this works fine:

Hope this helps :slight_smile:

Thank you! I’ve been stuck because i wrongly thought base64 encoded string is somewhere in binary properties. Your example clears everything

1 Like

Glad to hear, thank you so much for confirming :blush:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.