Nodes/Quality of Life Nodes for ComfyUI/Load Text From File (Soze)
ComfyUI Node

Load Text From File (Soze)

Read a text file, wrap it, wire it in

By SozeInc·Created 2 years ago·Updated 5 days ago· 10
Load Text From File (Soze)
    • text_output
    filename_path
    prepend_text_line
    append_text_line

    This reads a plain text file off disk and hands you back a STRING - a prompt someone else wrote, a caption a captioning node saved earlier, a config value, anything sitting in a .txt on your machine. Straightforward on its own, but it has one feature that makes it more than a bare file reader: it can wrap whatever it loads with fixed text before and after, without you touching the file itself.

    How it works

    Point it at filename_path, it opens the file and reads the contents. Then it stitches your prepend_text_line in front and your append_text_line on the end, and hands the whole thing back as text_output. That's genuinely useful when the file's content is the part that changes - a swappable subject description, a rotating prompt fragment - but you want a stable preamble or suffix (style tags, a negative-prompt boilerplate, a closing instruction) that stays put regardless of what's in the file. Instead of editing the static wrapper text every time you swap files, you set it once on the node and only the loaded file changes.

    The inputs and outputs that matter

    • filename_path (required, STRING) - the file to read.
    • prepend_text_line / append_text_line (required, multiline STRING) - fixed text glued before/after the loaded content. Leave either blank if you don't need it.

    One output: text_output, the combined string, ready to feed a CLIP Text Encode, another string node, or a save/log node further down the graph. Note this node is flagged as an output node in its own schema even though it hands back a socket - in practice that likely means you'll also see its result rendered on the node itself, in addition to wiring text_output onward.

    How to install it

    ComfyUI Manager → search "ComfyUI_Soze" → install → restart. Manual:

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

    then restart. No models, no external service, no heavy dependency beyond the base pack's requirements.txt.

    Common issues & troubleshooting

    The standard gotcha with any raw-path file node: a relative path resolves relative to wherever the ComfyUI process itself was started, which is not necessarily your workflow's folder or your input/ directory. If a path that "should" work throws file-not-found, try the full absolute path first to rule that class of bug out before you go hunting elsewhere.

    If your output looks wrong - extra content stacked in a way you didn't expect - check whether prepend_text_line or append_text_line still has leftover text from a previous experiment. Since both are plain multiline fields with no visual indicator that they're "on," it's easy to forget one is populated.

    This pairs naturally with Save Text File To Output or Append To Text File for round-tripping state - read what a previous run wrote, use it, write an updated version back - and with Prompt Cache if you want to keep a prompt available across runs without a file on disk at all.

    Categorysoze

    Inputs (3)

    NameTypeDefaultDescription
    filename_pathSTRING
    prepend_text_lineSTRING
    append_text_lineSTRING

    Outputs (1)

    NameTypeDescription
    text_outputSTRING