Nodes/ComfyUI-Teeth/Teeth Save Text File
ComfyUI Node

Teeth Save Text File

Save Text to Disk From Any Node (With a One-Click OpenDir Button)

By steelan9199·Created 2 years ago·Updated about a year ago· 10
Teeth Save Text File
      text
      folderoutput
      filenamesaved_text.txt
      add_timestamptrue
      add_randomtrue
      encodingutf-8
      always_runfalse

      A Gemini caption, a generated prompt, an API response, a chunk of metadata - text lives in your graph all the time, and eventually you want it on disk. Teeth Save Text File takes any STRING and writes it to a file, with timestamping and random suffixes so it never overwrites what you already saved. It's the "pour this text onto the floor and keep it" node from the ComfyUI-Teeth pack, and the one nicety it has that many rivals skip: an OpenDir button right on the node that opens the output folder in your OS file explorer.

      No models, no API, no setup. If you can type a folder name, this node works.

      How it works

      The mechanics are unglamorous and solid. You give it text (the content, forced as an input connection rather than a text box - so wire anything into it), a folder, and a filename. It creates the folder if it doesn't exist, writes the file with your chosen encoding, and - here's the part that shapes how you'll use it - by default it mangles the filename to keep history:

      saved_text.txt  →  saved_text20260816_143025_3fa9c1d2.txt
      

      Both add_timestamp (YYYYMMDD_HHMMSS) and add_random (an 8-character UUID chunk) default to on. Every run produces a brand-new file. That's a feature - nothing gets silently overwritten - but it's also how a folder becomes 400 text files after an afternoon of experimentation.

      Inputs and outputs that matter

      • text - the STRING to save (forceInput, so connect it from a text-producing node).
      • folder - where to write. Default output special-cases to ComfyUI's actual output directory; anything else is used literally (relative paths resolve against the ComfyUI root).
      • filename - base name, e.g. saved_text.txt.
      • add_timestamp / add_random - the uniquifier toggles. Turn both off to overwrite the same file every run.
      • encoding - utf-8 / gbk / latin-1 / ascii.
      • always_run - force a write every run; off by default.

      No outputs - it's an output node. It's the end of the line for that text.

      Where people get burned

      The folder fills up. Default behavior never overwrites. If you want a stable, single file (say, for a prompt file you'll Load Text File from later), switch add_timestamp and add_random off. Otherwise embrace the file hoard.

      output is magic, everything else isn't. folder = "output" correctly resolves to ComfyUI's output directory. folder = "./output" or any relative path resolves against the ComfyUI install root, which may or may not be what you meant. Absolute paths are the safe choice for anything custom.

      Same text, no rewrite. The cache hash includes the text content, so an identical string won't be re-written unless always_run is on. With timestamping on this is usually moot - new filename every run - but if you've turned off the suffixes and the file seems "stuck," that's why.

      Install

      ComfyUI Manager: search ComfyUI-Teeth. Or:

      cd ComfyUI/custom_nodes
      git clone https://github.com/steelan9199/ComfyUI-Teeth
      

      Restart ComfyUI. Standard library plus a ComfyUI route for the OpenDir button - no dependencies worth worrying about. It pairs naturally with the pack's Teeth Load Text File for round-tripping.

      CategoryTeeth

      Inputs (7)

      NameTypeDefaultDescription
      textSTRING
      folderSTRINGoutput
      filenameSTRINGsaved_text.txt
      add_timestampBOOLEANtrue
      add_randomBOOLEANtrue
      encodingCOMBOutf-84 options: utf-8, gbk, latin-1, ascii
      always_runBOOLEANfalse

      Outputs (0)

      No outputs