ComfyUI Node

File Loader (Soze)

Read a text file's contents into your graph

By SozeInc·Created 2 years ago·Updated 5 days ago· 10
File Loader (Soze)
    • STRING
    filepath

    Reads a file's text content and hands it back as a STRING. That's the whole node - the read-side complement to a plain text editor, useful anywhere you'd rather keep something (a long prompt, a block of tags, a config snippet) in a real file instead of pasted into a node's widget.

    It's the simplest node in a pack that's mostly built out of small, single-purpose utilities like this one. There's no parsing, no format assumptions, no special handling for any particular kind of text file - it just reads whatever's there and passes it on, which is exactly what makes it flexible. Whatever downstream node consumes the string decides what the text means.

    How it works

    Point it at a path, it reads the file and outputs the contents as a single string on every run. Because it re-reads on every execution rather than caching, editing the source file between runs and hitting queue again picks up the change immediately - there's no need to restart ComfyUI or reload the node just because the underlying text changed.

    The inputs and outputs that matter

    • filepath (STRING, required) - path to the file to read.
    • Output: a single STRING - the file's contents.

    How to install it

    Via ComfyUI Manager: search "Quality of Life Nodes for ComfyUI", install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/SozeInc/ComfyUI_Soze.git
    pip install -r ComfyUI_Soze/requirements.txt
    

    No dependencies beyond the base pack, no API key.

    Common issues & troubleshooting

    Why not just paste the text into a String node? You can, and for a one-off that's simpler. This node earns its place when the text is long, edited often, or lives outside ComfyUI already - a prompt file you're editing in a real text editor, something version-controlled, or something generated by another tool that writes to disk. Reload the file, hit run, get the fresh content - no copy-paste round trip.

    Encoding or garbled characters. The schema doesn't expose an encoding option, so if your file uses something other than a standard text encoding, you may see mangled output - re-save the source file as plain UTF-8 text first.

    You need to read binary data, or something structured. This is a plain text loader based on its schema - one path in, one string out. For structured data specifically, this pack has dedicated nodes: reach for CSV Reader for CSV, or the JSON-family nodes if what you're loading is JSON.

    File not found. Straightforward, but worth checking the obvious things first: a relative path is being resolved against a working directory you didn't expect, or there's a typo in an extension you can't see easily in a narrow node widget. Paste the path into a terminal ls (or File Explorer) first if a run keeps failing on a file you're sure is there.

    CategorySoze Nodes

    Inputs (1)

    NameTypeDefaultDescription
    filepathSTRING

    Outputs (1)

    NameTypeDescription
    STRINGSTRING