ComfyUI Node

Save Txt File

ComfyUI won't remember anything unless you give it a notepad — that's what TxtSave is for

By ifmylove2011·Created about a year ago·Updated 6 days ago· 4
Save Txt File
      text
      filename001.txt
      src_modetrue

      ComfyUI is great at making images and lousy at keeping notes. You'll burn a prompt you liked, a list of seeds, or a batch of detected tags, and the only record is whatever you managed to copy by hand. TxtSave is the pack's notepad: wire any text string in, give it a filename, and it writes a .txt file for you. It's from the small comfyui-missed-tool grab-bag, and it's one of the few nodes there with zero learning curve.

      The classic use is archiving. Save your final prompt next to your outputs, dump the tag list your model just produced, or log per-frame data from a batch workflow so you can compare later. It's an output node - the ComfyUI equivalent of Save Image, but for text.

      How it works

      TxtSave takes three inputs and returns nothing you wire into anything else (it's a terminal node, like a save button):

      • text - the string to save. It's a forced input, so it can come from any STRING output (a text node, a prompt concatenator, whatever) or you can type in the widget.
      • filename - default 001.txt.
      • src_mode - the checkbox that decides where the file lands. This is the one to understand.

      src_mode on (the default) means filename is treated as a full path. The node strips any extension, tacks on .txt, and - the nice bit - creates the parent directory if it doesn't exist. So output/prompts/pose_001.txt just works. With src_mode off, filename is treated as a bare name and the file is written to ComfyUI's working directory (the folder you launched it from). That sounds harmless until you can't find the file, which brings us to the footgun.

      Common issues

      • "Where did my file go?" - The #1 complaint, and it's usually src_mode off. The file lands in the ComfyUI working directory, not ComfyUI/output. Turn src_mode on and give a full path so you always know where it lands.
      • Double extensions. With src_mode off, whatever you type gets .txt appended verbatim - type notes.txt and you get notes.txt.txt. The src_mode path strips the extension first, so it's safe to include one there.
      • Empty text. The node logs an error if text is blank but still writes the file. Not a crash, just a wasted empty file - check the text isn't empty if you see an error line in the console.

      Installing it

      Same story as the rest of this pack - no model downloads, no heavy dependencies, just torch/numpy/Pillow which ComfyUI already has. Easiest is ComfyUI Manager, search comfyui-missed-tool:

      cd ComfyUI/custom_nodes
      git clone https://github.com/ifmylove2011/comfyui-missed-tool.git
      

      Then restart ComfyUI. You'll find it under the missed-tool category. If the pack is already installed for another node, you already have TxtSave - it's one file in a single pack, so there's nothing extra to add.

      Categorymissed-tool

      Inputs (3)

      NameTypeDefaultDescription
      textSTRING
      filenameSTRING001.txt
      src_modeBOOLEANtrue

      Outputs (0)

      No outputs