ComfyUI Node

ZF Load TXT

Pull a saved TXT back into the graph, auto-listed and fresh

By Z-yaofang·Created 2 months ago·Updated 19 days ago· 1
ZF Load TXT
    • text
    • file_path
    directoryTXT
    file_name

    The natural companion to the pack's timestamped TXT saver is a loader, and that's exactly what ZFLoadTextFile (display name "ZF Load TXT") is: pick a folder, pick a file from an auto-populated dropdown, and get the entire text back as a string - blank lines included. If you're keeping a prompt archive on disk (which the sibling save node encourages), this is the half that gets it back into a workflow without retyping anything.

    It's part of ZF-ComfyUI-Helper, the dependency-free utility pack, under ZF Helper/Text.

    How the file picking works

    Two inputs, and the second one is the clever part:

    • directory - where to look. Relative paths (default TXT) resolve below ComfyUI's output folder; absolute local paths work too. This mirrors the save node exactly, so anything you saved with ZFSaveTextTimestamped into TXT is loadable here with the same TXT.
    • file_name - a dropdown, not a free-typed name. The node scans the folder and lists every .txt without the extension, sorted by most recently modified. You pick from real files instead of guessing a name. To load E:\Text Archive\result.txt, you set the directory to E:\Text Archive and pick result.

    The dropdown refreshes automatically when the directory changes, and there's a manual refresh button too - handy when you've just saved a new file and want it to appear without a ComfyUI restart. Under the hood that scan runs through a small backend endpoint the pack registers (/zf-helper/txt-files), which is why the file list stays live rather than being baked in at node load.

    What comes out

    Two outputs: text (the full contents, blank lines preserved - the README is explicit that nothing is stripped) and file_path (the absolute path, useful for display or downstream logic). The loader decodes UTF-8 first, then falls back to UTF-16 and GB18030, so files saved by a mix of tools and locales usually just work instead of throwing mojibake at you.

    A deliberate detail: the node does not require the file to exist at validation time. It can sit on a lazy fallback branch that isn't executed, and only errors if ComfyUI actually asks it to load a missing file. That makes it safe to wire into a conditional route without spamming validation errors every queue.

    Installing it

    The usual trivial install for this pack - no dependencies:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Z-yaofang/ZF-ComfyUI-Helper
    

    Restart ComfyUI, or search ZF-ComfyUI-Helper in ComfyUI Manager. No models, no requirements.txt.

    Where people trip

    Two things. First, the file_name field is extension-free on purpose - typing result.txt fails, because the dropdown values are already stripped. If you're the type to type ahead, don't. Second, "most recently modified" sorting means the dropdown order changes as you save new files; that's usually what you want (freshest first), but it means the dropdown is a live view, not a stable list. And worth knowing: this node is a reader - it pairs with the timestamped saver, but it will happily read TXT files you created anywhere, including files ComfyUI's built-in text-output doesn't produce. It's the "get my text back from disk" node, full stop.

    CategoryZF Helper/Text

    Inputs (2)

    NameTypeDefaultDescription
    directorySTRINGTXTRelative paths are resolved below the ComfyUI output folder. Absolute local paths are also supported.
    file_nameCOMBOTXT file name without its .txt extension or folder path.

    Outputs (2)

    NameTypeDescription
    textSTRING
    file_pathSTRING