Nodes/comfyui_gr85/Save Text File
ComfyUI Node

Save Text File

Dump any string to disk with auto-numbered filenames

By veighnsche·Created 2 years ago·Updated 8 months ago· 1
Save Text File
      text
      path./ComfyUI/output/
      filename_prefixComfyUI
      filename_delimiter_
      filename_number_padding4
      file_extension.txt
      encodingutf-8

      This one does exactly what the name says, and that's the whole appeal: it takes a STRING input and writes it to a .txt file on disk, the same way SaveImage writes a PNG. If you've ever wanted to log the exact prompt a workflow used, dump a wildcard-expanded prompt for later reuse, or archive whatever a captioning node spat out, this is the node you wire the string into.

      It's a plain output node - no return values, nothing downstream to connect. You point it at a folder, it writes a file, run finished.

      The inputs that matter. text is your multiline string - usually the far end of a prompt builder, a wildcard picker, or a caption node. path defaults to ./ComfyUI/output/, and that default is worth noting because it's relative, not absolute - where it actually lands depends on ComfyUI's working directory when it started, which isn't always where you'd guess, especially inside Docker or a managed environment. If you want predictability, point path at an absolute path instead of trusting the default. filename_prefix (default "ComfyUI") and filename_delimiter (default "_") build the base filename, and filename_number_padding controls how many digits the auto-incrementing counter gets - 4 by default, so you get ComfyUI_0001.txt, ComfyUI_0002.txt, and so on, incrementing so repeated runs don't clobber each other. Two optional fields round it out: file_extension (default .txt, change it if you're writing JSON or a caption sidecar with a different suffix) and encoding (default utf-8, there if you ever need something else).

      Installing it. Same as every other node in this pack - search "comfyui_gr85" in ComfyUI Manager, or:

      cd ComfyUI/custom_nodes
      git clone https://github.com/veighnsche/comfyui_gr85
      

      Restart ComfyUI afterward. No model downloads, no extra Python dependencies - it's a file-write utility, so it's as lightweight as custom nodes get.

      Where this bites people. The relative default path is the recurring one - you run a workflow, it reports success, and then you can't find the file because it landed under whatever directory the ComfyUI process happened to launch from rather than the output folder you were looking in. Set an absolute path once and you'll never chase that again. The other thing worth knowing: this node writes on every execution where it's in the active graph, so if you leave it wired into a loop or a batch you're testing repeatedly, you'll accumulate a lot of small numbered text files fast - the padding counter keeps them from overwriting each other, but it also means nothing gets cleaned up automatically. If you only wanted the last one, you're the one who has to delete the rest.

      CategoryGR85/Utils

      Inputs (7)

      NameTypeDefaultDescription
      textSTRING
      pathSTRING./ComfyUI/output/
      filename_prefixSTRINGComfyUI
      filename_delimiterSTRING_
      filename_number_paddingINT40–9
      file_extensionoptSTRING.txt
      encodingoptSTRINGutf-8

      Outputs (0)

      No outputs