Nodes/ComfyUI-TJ_NODE/Save Text File (TJ)
ComfyUI Node

Save Text File (TJ)

Save Text File (TJ)

By designloves2·Created 4 months ago·Updated 3 days ago· 13
Save Text File (TJ)
    • text
    text
    get_name
    setnode_name
    pathimage/%date
    filename_prefiximage
    filename_delimiter_
    filename_number_padding4
    file_extension.txt
    encodingutf-8
    filename_suffix

    Sometimes you don't want a prompt in the workflow - you want it on disk, right now, next to the images it generated. Save Text File (TJ) writes a string to a file and passes the same string straight through its output, so you can drop it in the middle of a chain as a logger without breaking the flow. It's the node for "save the prompt that made this" without fighting ComfyUI's metadata embedding or manually copy-pasting.

    How it works

    Give it text, it writes it. The inputs control exactly where and how:

    • text - the string to save (prompt, seed list, whatever). It can also be fed wirelessly via get_name.
    • path - destination, default image/%date (a date-named folder under output). %date expands to today.
    • filename_prefix - the base name (default image).
    • filename_delimiter - separates prefix, number, and suffix (default _).
    • filename_number_padding - digit padding on the auto-increment (default 4, so image_0001.txt).
    • filename_suffix - an optional extra suffix.
    • file_extension - default .txt; change to .json, .md, whatever.
    • encoding - the one that betrays the author's Korean roots: utf-8, utf-8-sig, cp949, euc-kr, ascii. On Windows, cp949/euc-kr matter for Korean filenames/content; everyone else mostly wants utf-8.

    Output: text - the exact string you put in, passed through unchanged. So you can log a prompt to file and keep feeding it downstream in the same wire.

    There's also setnode_name for publishing the text to the TJ wireless registry, making it usable as a wireless sender as well as a file writer.

    Installing it

    Standard pack install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/designloves2/ComfyUI-TJ_NODE
    

    or ComfyUI Manager → ComfyUI-TJ_NODE → restart. No dependencies beyond the pack.

    The honest take

    It's a utility node and it knows it. The pass-through output is the design detail worth noticing - most "save text" nodes dead-end the flow, but this one lets you log and continue in the same breath. The best pattern is pairing it with the save pipeline: run a Save Image (Primary-TJ) for the picture and a Save Text File with the same prefix for the prompt, and you get main.png + main.txt side by side, everything reproducible without digging into metadata. One practical note: the filename fields are separate widgets, so if you want main_prompt.txt matching a main_0001.png, mirror the prefix and let the padding do the rest. Encoding only becomes your problem if you're writing non-ASCII text on Windows - then utf-8-sig is the safer default than plain utf-8.

    Category ✨ TJ_Node/Utility

    Inputs (10)

    NameTypeDefaultDescription
    textSTRING
    get_nameCOMBO1 options: (none)
    setnode_nameSTRING
    pathSTRINGimage/%date
    filename_prefixSTRINGimage
    filename_delimiterSTRING_
    filename_number_paddingINT40–12
    file_extensionSTRING.txt
    encodingCOMBOutf-85 options: utf-8, utf-8-sig, cp949, euc-kr, ascii
    filename_suffixSTRING

    Outputs (1)

    NameTypeDescription
    textSTRING