Use this any time a workflow needs to convert a downloaded file (an image, a document) into base64 for sending to another API, like an AI vision endpoint.
Steps
- Don't reach for the Code node first for this. Instead, search for the Extract From File node.
- Set its Operation to "Move File to Base64 String".
- Set Binary Property Name to whatever the incoming binary field is called (commonly
data). - Set Destination Output Field to something distinct, like
base64, not the same name as the binary field, to avoid overwriting it. - Reference the output downstream as
$json.base64.
Gotcha
A Code node using this.helpers.getBinaryDataBuffer() or a similar manual approach can, depending on the platform version and how binary data is stored internally (memory vs filesystem mode), return a storage reference string instead of the actual decoded bytes. This produces a confusing downstream error, like an API rejecting the payload with a "base64 decoding failed" message that references something like a filesystem pointer, not obviously related to the code you wrote. If a manual binary conversion is producing bizarre errors, try the platform's dedicated built-in node before assuming the surrounding logic is wrong, the bug may be in the binary access method itself.
Quick reference
Download file → Extract From File (Move File to Base64 String) → use $json.base64 downstream