Nodes/ComfyUI Ino Nodes/Ino File To Base64
ComfyUI Node

Ino File To Base64

Any file on disk → a data URI string, ready to hand to an API

By nobandegani·Created about a year ago·Updated 2 months ago· 6
Ino File To Base64
    • success
    • message
    • data_uri
    enabledtrue
    parent_folder
    folder
    filename
    mime_type

    OpenAI-style vision APIs don't take file paths - they take base64-encoded data URIs like data:image/png;base64,iVBORw0K.... If you're building a ComfyUI workflow that talks to an LLM or vision model, at some point you need to turn a file on disk into that giant string. Ino File To Base64 does it in one step, with the MIME type figured out for you.

    It's from ComfyUI-InoNodes, the 125+ node automation pack, and it sits alongside a sibling, Ino Image To Base64, that converts an in-graph IMAGE tensor instead. This one reads from disk, which is what you want when the file was written by an earlier node (a saved image, a downloaded file, an S3 pull).

    The inputs

    Standard Ino file-node layout, plus one useful override:

    • parent_folder - dropdown: input, output, or temp.
    • folder - subfolder path.
    • filename - the file to convert.
    • mime_type - optional. Leave empty and the node auto-detects the MIME type from the file. Set it (e.g. application/pdf) if you need to force a specific type.

    Outputs are success, message, and data_uri - the last one being the full data:<mime>;base64,<payload> string you can paste straight into a JSON body.

    How it works

    It resolves the file path through the same resolve_comfy_path helper the whole pack uses, then hands it to the shared inopyutils library's file-to-base64 function, which reads the bytes, base64-encodes them, and - if you didn't force a MIME type - detects it from the file itself. Auto-detection is the part worth caring about: you don't have to remember that PNGs are image/png and JSON is application/json; the node just knows.

    Where it fits

    • Vision LLM calls. The pack ships OpenAI nodes (Ino Openai Responses, Ino Openai Chat Completions) that accept text or image prompts - feed them data_uri from here.
    • Generic API POSTs. Ino Http Call can carry the data URI in its JSON payload to any endpoint that accepts base64 media.
    • Uploads to S3 or elsewhere. Convert a local file to a string you can stash in a config or pass to a remote service.

    If your source is already an in-graph IMAGE tensor, use Ino Image To Base64 instead - no round-trip through disk. This node's whole point is that the file already exists somewhere in ComfyUI's tree and you just need its base64 form.

    Gotchas

    Watch out for the enabled toggle - every node in this pack has one, and when it's off the node returns success: false with an empty data URI. That's a classic "why is my API call empty?" moment. And remember the pack's parent-folder limitation: input, output, and temp only. Files outside ComfyUI's directories aren't reachable. Also, base64 expands a file by ~33%, so a large video becomes a very long string - if ComfyUI or your API chokes, that's usually why.

    Installation

    Ships with ComfyUI-InoNodes:

    • ComfyUI Manager: search "ComfyUI Ino Nodes", install, restart.
    • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/nobandegani/comfyui_ino_nodes && cd comfyui_ino_nodes && pip install -r requirements.txt, restart.

    Needs Python 3.10+ and ComfyUI 0.18.1+ (V3 schema). No models, no API keys - the base64 conversion is fully local.

    CategoryInoFileHelper

    Inputs (5)

    NameTypeDefaultDescription
    enabledBOOLEANtrue
    parent_folderCOMBO3 options: input, output, temp
    folderSTRING
    filenameSTRING
    mime_typeoptSTRINGLeave empty for auto detection

    Outputs (3)

    NameTypeDescription
    successBOOLEAN
    messageSTRING
    data_uriSTRING