Nodes/ComfyUI FRED Nodes v2/πŸ‘‘ FRED Save Text File
ComfyUI Node

πŸ‘‘ FRED Save Text File

Write text to a file from your workflow β€” append, overwrite, or never clobber

By PoukpalaovaΒ·Created about a year agoΒ·Updated 7 months agoΒ· 3
πŸ‘‘ FRED Save Text File
    • SUCCESS?
    • STATUS
    • help
    β—„folder_path.β–Ί
    β—„file_nameoutβ–Ί
    β—„file_extension.txtβ–Ί
    β—„modeβ–Ύβ–Ί
    β—„terminatortrueβ–Ί
    β—„skip_if_duplicatetrueβ–Ί
    β—„textβ€”β–Ί

    ComfyUI will happily hand you prompts, seeds, and metrics as text strings - and then make you copy them by hand if you want them on disk. FRED_Save_Text_File writes text from your graph directly to a file, with three write modes and a duplicate-skip that makes it safe to use as an append-only log. It's a small node, but it's the missing end of the wire for any "record what this run did" workflow.

    The inputs

    • text - the string to write. Feed it a prompt, a seed, a metric, or a concatenation of them.
    • folder_path (default .) - where the file goes. Relative paths resolve from ComfyUI's working directory, or use absolute.
    • file_name (default out) and file_extension - .txt, .csv, or .json. Note the extension is a dropdown with the leading dot built in.
    • mode - the behavior:
      • append - add to the file, creating it if missing. terminator (default on) adds a line break before each append so entries don't merge together.
      • overwrite - replace the whole file each run.
      • new only - write only if the file doesn't exist yet. Your built-in "don't clobber my work" guard.
    • skip_if_duplicate (default on) - in append mode, if the exact text is already in the file, it skips the write. This is the setting that turns the node into a deduplicating log: same prompt twice in a batch β†’ recorded once.

    The outputs

    • SUCCESS? (BOOLEAN) - did the write happen (or get skipped cleanly)?
    • STATUS (STRING) - human-readable result: file appended, file overwritten, file created, text already exist, file already exist, etc. Wire this into a text display to see what happened without opening the file.

    What you'd use it for

    • Automatic run logs. Pipe execution_time_str from FRED_ExecutionTime, a seed, and a prompt into the text input; append mode; every run adds a line. Your own benchmark history with zero manual work.
    • Prompt/tag collection. Dump the prompts you actually liked into a .csv as you generate, deduped by skip_if_duplicate, and you've slowly built a usable prompt library.
    • Dataset labels or sidecars. Write JSON per image or per batch for a training run.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/Poukpalaova/ComfyUI-FRED-Nodes_v2.git
    

    Restart, or "ComfyUI FRED Nodes v2" via ComfyUI Manager. No extra dependencies - it's plain file I/O.

    Gotchas

    Two worth knowing. First, .csv output is raw text, not quoted/escaped CSV - if your text contains commas, don't expect spreadsheet-grade parsing without doing your own formatting. Second, new only is a once-ever guard per filename: if the file exists from a previous session, it stays unwritten forever, which is exactly what it promises but easy to forget when you're testing and the node "does nothing." Delete the file (or change the name) to reset it.

    CategoryπŸ‘‘FRED/text

    Inputs (7)

    NameTypeDefaultDescription
    folder_pathSTRING.Target folder (relative or absolute). Will be created if missing.
    file_nameSTRINGoutOutput file name without extension
    file_extensionCOMBO.txtFile extension to use
    modeCOMBOHow to write: Append (add), Overwrite (replace), or New Only (create if missing)
    terminatorBOOLEANtrueAdd a line break in append mode before writing text
    skip_if_duplicateBOOLEANtrueIf enabled (append mode), do not write if this text already exists in the target file.
    textSTRINGText to write to the file. Right click and convert to input for dynamic content.

    Outputs (3)

    NameTypeDescription
    SUCCESS?BOOLEANTrue if file written/skipped as intended, False on error
    STATUSSTRINGOperation result: file appended, file overwritten, file created, text already exist, file already exist, error
    helpSTRINGThis message (detailed help/instructions)