Nodes/Orion4D_MetaNode/πŸ“„ Load Text File
ComfyUI Node

πŸ“„ Load Text File

Drop your prompt library onto the canvas β€” it lands editable

By orion4dΒ·Created 5 months agoΒ·Updated 5 months agoΒ· 5
πŸ“„ Load Text File
    • text
    β—„text_contentβ–Ί

    The Load Text File is the rare loader that doesn't try to hide anything from you. Drag a .txt, .json, .csv or any other text file onto it, and the file's content lands right in a multiline text widget on the node - visible, editable, part of your workflow. Load it, tweak it, save the workflow, and the content travels with the PNG. No hidden file references to break later.

    This is the node for the "prompt library" workflow: you keep a library of styles, character sheets, or negative-prompt blocks in plain text files, and instead of copy-pasting snippets by hand you just load the file and the text becomes live data you can route to a text encoder or a concatenator. The README frames it as the anti-storage approach - no dropdown, no remembered paths, just "read the file, show me the content, let me edit it."

    How it works

    There are two layers. The visible one is simple: the node's only input widget, text_content, holds the text. Load a file from the node's UI and the client-side JavaScript reads it and stuffs the result into that widget - with a server fallback route (/orion4d/read_text_file) for cases where the browser can't read the file directly.

    The server side is where the real work happens. It validates the extension against an allowlist (.txt, .json, .csv, .py, .md, .yaml, .toml, .xml, .html, .sh, .bat, .ini, .cfg, .env, .log, and a few more), caps files at 10 MB to stop memory abuse, and tries four encodings in order - UTF-8, UTF-8 with BOM, Latin-1, then CP1252 - so oddball-encoded files still load.

    One detail that matters: the node's IS_CHANGED method hashes the widget content on every run. That means if you edit the text right in the node, ComfyUI notices and re-runs the downstream graph - you don't have to force anything.

    Inputs and outputs

    • Input: text_content (STRING, multiline) - the editable content, empty by default.
    • Output: text (STRING) - the content, passed through.

    There's exactly one widget and one wire, which is the whole point.

    Where it fits

    Wire text straight into a CLIP Text Encode for prompts you maintain as files, or into the pack's Text Road when you want to assemble several file-based fragments. The file doesn't have to exist again on the other end - once loaded, the content is baked into the node, which is also the portability win: share the workflow and the text comes along, no external file needed.

    Troubleshooting

    • Unsupported extension? Refused, on purpose. The allowlist is enforced server-side, so a .exe or a random binary isn't going to load.
    • Over 10 MB? Refused with a size error. These are text files; if yours is that big, something's off.
    • Weird characters on load? If the file is in an encoding outside the four tried, you'll get a decode error - resave the file as UTF-8 and it'll load cleanly.

    Installing it

    It ships with the whole pack - Orion4D_MetaNode:

    cd ComfyUI/custom_nodes
    git clone https://github.com/orion4d/Orion4D_MetaNode
    

    Or install via ComfyUI Manager (search "Orion4D_MetaNode") and restart. Find it under Orion4D_MetaNode β†’ Loaders. No extra pip packages, no model downloads. Honest context: this is a young, single-developer pack with a small footprint, so it's a useful utility rather than a community staple - but for "file becomes editable text in my graph," it does the job cleanly.

    CategoryOrion4D_MetaNode/Loaders

    Inputs (1)

    NameTypeDefaultDescription
    text_contentSTRINGβ€”

    Outputs (1)

    NameTypeDescription
    textSTRINGβ€”