Nodes/ydem_nodes/YDem Load Text File
ComfyUI Node

YDem Load Text File

The Dumbest Node in the Pack Is the One You'll Reach For

By luoq24·Created 7 months ago·Updated 2 months ago· 0
YDem Load Text File
    • text_content
    • data
    file_path

    YDem Load Text File does exactly what the name says: you give it a path, it reads the file, and it hands you the contents. That sounds too trivial to bother with until the moment you realize you've been retyping a JSON blob into a text widget with your own two hands. The author built it for their own pipeline - the source comment says it exists to feed a QwenEditOutputExtractor - and honestly, that's the right job for it. Anything where a tool outside ComfyUI writes a file and you want that file inside the graph, this is your door in.

    What it actually outputs

    Two outputs, always both of them:

    • text_content (STRING) - the raw file contents as one big string. Wire this into any STRING slot: a prompt, a metadata field, a text node, whatever.
    • data (ANY) - the same contents, but if the file parses as JSON, you get the parsed object instead of a string. That's the trick. A dict or list flows out of an untyped ANY port, ready for any node that eats structured data.

    It's a small design, but a smart one: you never have to guess whether the file is text or JSON, because you get both readings at once. The author's own case was a Qwen edit-output extractor - dump the model's JSON response to disk, load it back in here, feed data onward. If you've ever piped tool output through ComfyUI by hand, you'll see the appeal instantly.

    The one input

    file_path is a plain STRING widget, not a file browser. You type the path. Absolute paths are your friend - relative ones resolve against wherever ComfyUI happens to be running, and that's a great way to confuse yourself at 1 a.m.

    The node reads with UTF-8 encoding, so keep your files in UTF-8. And if you pass an empty path, it raises a ValueError rather than silently doing nothing - annoying the first time, honest the second.

    Installing it

    This node ships in the luoq24/ydem_nodes pack alongside three pose-processing siblings. Two ways in:

    • ComfyUI Manager - search "ydem_nodes" and hit install.
    • Manual - clone it into your custom nodes folder:
    cd ComfyUI/custom_nodes
    git clone https://github.com/luoq24/ydem_nodes
    

    Then restart ComfyUI. There's no requirements.txt and no model download for this node - it only needs Python's built-in json module, so it's about as dependency-free as a custom node gets. (The pose nodes in the same pack are a different story; they need comfyui_controlnet_aux. This one doesn't.)

    Where people get burned

    The classic stumble: you wire data into something expecting a string and ComfyUI happily lets you, because ANY connections aren't type-checked. If your file isn't valid JSON, data silently comes back as the same string as text_content, and downstream nodes may behave oddly. Check that the file parses before you trust the ANY port.

    That's the whole node. It's not glamorous, it won't show up in showcases, but the next time a script dumps something to disk and you need it in your workflow, you'll be glad it's in the pack.

    Categoryydem_nodes/io

    Inputs (1)

    NameTypeDefaultDescription
    file_pathSTRING

    Outputs (2)

    NameTypeDescription
    text_contentSTRING
    dataANY