Nodes/comfyui-easyapi-nodes/SaveTextToLocalFile
ComfyUI Node

SaveTextToLocalFile

Write text straight to a path you choose

By lldacing·Created 3 years ago·Updated 8 months ago· 96
SaveTextToLocalFile
    • text_path
    text_path
    text

    The general-purpose sibling of SaveTextToFileByImagePath - no filename derived from an image, you give it the exact full path and it writes the text there. Reach for this whenever you're not saving a caption alongside an image and just need to dump text - a log entry, a generated description, a JSON blob built with this pack's ConvertToJsonStr - to a known location on disk.

    The inputs and outputs that matter

    • text_path (STRING) - the full save path. Its own tooltip in the node is worth reading literally: it states plainly that this will not auto-create the file's directory for you.
    • text (STRING, multiline) - the content to save.
    • text_path (STRING) - echoed back on output, mostly so you can chain this node into a log entry or a return value without a separate variable.

    How to install it

    Via ComfyUI Manager: search comfyui-easyapi-nodes, install, restart. Manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/lldacing/comfyui-easyapi-nodes.git
    cd comfyui-easyapi-nodes
    pip install -r requirements.txt
    

    Restart ComfyUI. No models needed.

    Common issues & troubleshooting

    Point it at a folder that doesn't exist yet and it fails, rather than creating one. That's the most common failure with this node - a save that errors on what looks like a perfectly reasonable path is almost always a directory that doesn't exist, not a permissions or formatting problem. Unlike SaveTextToFileByImagePath, which is affected by the pack's allow_create_dir_when_save setting, this node's own tooltip makes no such promise - make sure the destination folder already exists before running it.

    If you need the image-filename-derived naming instead, use SaveTextToFileByImagePath - this node has no concept of an associated image at all, it's purely path-in, text-in.

    It overwrites without asking. Run it twice against the same text_path and the second run replaces the first - there's no append mode and no "file already exists" guard. If you're calling this repeatedly inside a loop (say, once per item from ForEachOpen), make sure text_path is actually different on every iteration, usually by building it from whatever's driving the loop. A static path fed a dynamic loop is the classic way to end up with only the last iteration's text on disk.

    It's a good fit for anything that isn't naturally tied to an image filename. Logging the exact prompt used for a run, dumping a generated JSON summary from ConvertToJsonStr, or writing out a config file your next run will read back in with ReadTextFromLocalFile - anywhere the path is something you choose rather than something derived from another asset, this is the more direct of the pack's two text-saving nodes to reach for.

    CategoryEasyApi/Utils

    Inputs (2)

    NameTypeDefaultDescription
    text_pathSTRING保存的文件全路径,不会自动创建文件目录
    textSTRING

    Outputs (1)

    NameTypeDescription
    text_pathSTRING