Nodes/ComfyUI_WordCloud/Load Text File
ComfyUI Node

Load Text File

Read prompts and text from a file instead of pasting them into a box

By chflame163·Created 3 years ago·Updated about a year ago· 118
Load Text File
    • Text
    â—„pathc:\text.txtâ–º

    If you've ever kept a prompt in a text file because you didn't want to lose it to a browser tab, this is the node that gets it back into the graph. LoadTextFile reads a .txt file from a path you give it, decodes it as UTF-8, and outputs the whole thing as a single string. Boring, yes. Genuinely useful, also yes.

    Why you'd reach for it

    It's part of the chflame163/ComfyUI_WordCloud pack, and its natural partner is the Word Cloud node: keep your corpus, your tag list, or your negative-prompt library in a real file, point this node at it, and feed the string into text. That way a long body of text lives in version control or a shared folder instead of inside a workflow JSON. It also works as a general "load my prompts from disk" node for anything else that takes a string input.

    How it works

    One input, one output, no trickery. The path field is a plain string - no file browser, so you type or paste the path, defaulting to c:\text.txt on Windows. The backend runs os.path.normpath() on it, which quietly converts forward slashes to backslashes on Windows, then reads the file with UTF-8 encoding. It outputs a string named Text, and because it's an output node it also shows the file's contents in the UI so you can verify you loaded the right thing without hunting through your filesystem.

    Install

    Same as the rest of the pack - ComfyUI Manager by searching "WordCloud", or manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/chflame163/ComfyUI_WordCloud
    cd ComfyUI_WordCloud
    ..\..\..\python_embeded\python.exe -m pip install -r requirements.txt
    

    Then restart ComfyUI. No models, no extra assets - just a text reader.

    Where people trip up

    • It needs an absolute path. Relative paths from your ComfyUI folder may not resolve the way you expect, so give it the full path.
    • UTF-8 only. That's the one encoding it understands. A file saved as ANSI or UTF-16 will fail.
    • Failures are quiet. If the path is wrong or the encoding is off, it prints an error to the console (look for Load Text File -> ERROR) and outputs an empty string - which then flows silently into whatever you wired it to. If your word cloud suddenly comes out empty or your prompt vanishes, check the console first.
    • No watch/reload. It reads the file once at execution time, so edit-and-rerun works fine, but it won't auto-refresh while idle.

    It's the least glamorous node in the pack and that's exactly why it's the one that saves you from re-pasting a thousand-word corpus.

    Category😺dzNodes/WordCloud

    Inputs (1)

    NameTypeDefaultDescription
    pathSTRINGc:\text.txt—

    Outputs (1)

    NameTypeDescription
    TextSTRING—