ComfyUI Node

Read All Text

The simplest way to pull a whole file back into a workflow

By kale4eat·Created 2 years ago·Updated 2 years ago· 0
Read All Text
    • text
    • file_name
    file_name
    encodingutf-8

    The read half of the text-file-util pack, and the most literal node in it: pick a file, get its entire contents back as one string. If you've used the pack's Write Text node to save a prompt to disk, this is how you load it back into a later workflow without retyping it. If you've got a file of prompt text you want to pipe into a CLIP text encode, or a settings file you want to pull in, this is the node.

    It's deliberately dumb, and that's a feature. No parsing, no line handling, no magic - f.read() on whatever file you choose, returned as a single STRING output.

    How it works

    The file_name input isn't a text field you type into - it's a dropdown. On startup (and when you refresh the node) the pack scans a text_input/ folder that it creates in your ComfyUI install root, and lists every file it finds there, sorted. You pick one from the list. The node then reads the whole thing and hands it out.

    Two outputs come out of it:

    • text - the full file contents as one string, newlines and all.
    • file_name - the filename you picked, passed through. Useful if you're chaining something that needs to know which file it's looking at.

    The only optional input is encoding, defaulting to utf-8. Change it if your file is, say, latin-1; otherwise leave it.

    The input that matters

    Just file_name. Everything about this node hinges on the file being in the right place: ComfyUI/text_input/. That's the folder this pack reads from, and it's distinct from where the write nodes save (text_output/) - so the round trip is write to text_output/, then manually move the file into text_input/ if you want to read it back. The node won't do that for you. If the dropdown comes up empty, it's because nothing is in text_input/ yet, or you haven't restarted ComfyUI since adding a file.

    Installing it

    ComfyUI Manager → search ComfyUI-text-file-util, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kale4eat/ComfyUI-text-file-util
    

    Restart ComfyUI. Pure Python, no dependencies, no pip step.

    Where people get burned

    The dropdown not refreshing is the top complaint: you drop a file into text_input/ and it's not in the list. ComfyUI caches the node's input options at load, so restart (or reload) the frontend and it appears. The other trap is subtler - the pack lists every file in that folder, regardless of extension, so a stray image.png in text_input/ shows up in the dropdown and will be read as text. Keep the folder text-only. And remember the whole file comes back as one blob including newlines; if that breaks your prompt, the pack's Read All Lines node (which splits per line) is the variant to try instead.

    Categorytext-file-util

    Inputs (2)

    NameTypeDefaultDescription
    file_nameCOMBO0 options:
    encodingoptSTRINGutf-8

    Outputs (2)

    NameTypeDescription
    textSTRING
    file_nameSTRING