Nodes/Lite Text to File Tools/Load From Text File
ComfyUI Node

Load From Text File

Read a file back into your graph, no extra deps required

By JasonHoku·Created 7 months ago·Updated 6 months ago· 2
Load From Text File
    • text_content
    file_prefixtext/output.txt

    Write To Text File got your text onto disk. This is the node that brings it back. Load From Text File reads a file from ComfyUI's output directory and hands you its entire contents as a single string - ready to feed into a prompt encoder, a Show Text node, an LLM node, or anything else that eats strings.

    It's the read half of the pack's simplest save/load pair, and it's deliberately boring. One input, one output, no formatting options, no encoding dropdown. That plainness is the point: it's the least likely node in the pack to break, because there's almost nothing to configure.

    How it works

    Set file_prefix to the same path you used when saving. text/output.txt in the save node means ComfyUI/output/text/output.txt on disk, and this node resolves it the same way - relative to ComfyUI's output folder, never anywhere else (path traversal is rejected at the source level).

    Run it and the text_content output holds the whole file as one string. Wire that straight into a CLIPTextEncode and you've got a poor-man's prompt loader: edit the text file with any editor while a batch runs, and every execution picks up the current contents. People do this to iterate on prompts without touching the graph, and to hand-edit a list of entries that the graph reads back one run at a time.

    The failure mode you should know about

    This node does not fail the workflow when the file is missing. Instead of raising an error, load_from_file returns the string Error: File not found at <path> as its text_content output. That string then flows downstream like any other string - into your prompt encoder if you wired it that way.

    That's a real trap. A missing file won't show a red node; it'll silently bake Error: File not found at /path into whatever you're generating. If output starts looking weird, check whether a load node is returning an error string instead of content. The same soft-error pattern runs through most of this pack, and it's the main thing that surprises people.

    Installing it

    It ships inside the Lite Text to File Tools pack, so install is identical to the rest of the family:

    cd ComfyUI/custom_nodes/
    git clone https://github.com/JasonHoku/comfyui-lite-text-to-file-tools
    # restart ComfyUI
    

    Or skip the terminal and search "Lite Text to File Tools" in ComfyUI Manager. Either way there's no pip install, no model download, and nothing to clash with the rest of your environment - the whole pack is standard-library Python plus ComfyUI's built-in folder_paths.

    Where it fits

    This is the node to reach for when you want workflow state to survive between sessions without installing a heavier "text toolbox" pack. A hand-edited .txt file is portable, readable outside ComfyUI, and grep-able when you're hunting for a prompt from three days ago. If you need structured data instead of a flat string, the same pack's Load From JSON File is the sibling to reach for.

    Categorylite-text-to-file

    Inputs (1)

    NameTypeDefaultDescription
    file_prefixSTRINGtext/output.txt

    Outputs (1)

    NameTypeDescription
    text_contentSTRING