Nodes/ComfyUI_Text_Tools_SG/Text Tools Save Text json md File-SG
ComfyUI Node

Text Tools Save Text json md File-SG

A Save Image for strings

By ShammiG·Created 9 months ago·Updated 6 months ago· 7
Text Tools Save Text json md File-SG
      text
      filename_prefixComfyUI_text
      file_formattxt
      pretty_jsontrue

      ComfyUI will happily generate text - prompt variations, JSON configs, scripted output - and then do nothing with it. Text Tools Save Text json md File-SG is the missing "save" button: it writes a STRING to disk as .txt, .json, or .md, with auto-numbered filenames just like the built-in Save Image node. If you run batch prompt experiments, or a workflow produces structured data you want to keep, this is the node that gets your text out of the canvas and into a folder.

      It's from the ShammiG/ComfyUI_Text_Tools_SG pack, and it's designed to pair with the pack's own loaders: Save here, Load Text Json md-SG reads it back. There's a deliberate symmetry - Save defaults to ComfyUI/output, and the loader's output_text folder option points at a text subfolder there.

      The inputs

      All required, but only a couple need real attention:

      • text - the string to save, fed in by a wire. It's forced as an input, so there's no typing into this node; something upstream produces the text.
      • filename_prefix - base name, default ComfyUI_text. Supports %date% (2026-08-16), %time% (14-30-05), %timestamp% (Unix seconds), and formatted variants like %date:yyyy-MM-dd%. You can also use a subfolder in the prefix (e.g. prompts/batch1), and the node creates it. Files get a _00001-style counter appended so nothing is overwritten.
      • file_format - txt, json, or md. Obvious enough.
      • pretty_json - when json is selected and the input parses as valid JSON, it's re-serialized with 2-space indentation instead of being dumped as a raw blob. If the text isn't valid JSON, it saves as-is rather than erroring.

      There are no outputs. It's a sink - an output node, like Save Image, that reports the written file back to the UI.

      How it works

      The Python does exactly what Save Image does, but for text: resolve the output directory, expand any %date%/%time%/%timestamp% tokens, create subfolders, find the next free counter number, and write with UTF-8 encoding. Errors print to the console and return an empty result instead of killing your queue - which is more forgiving than it looks, since a missing-value failure mid-batch won't take down the rest.

      Install and the caveat that keeps showing up

      Standard for this pack - Manager, or:

      cd ComfyUI/custom_nodes
      git clone https://github.com/ShammiG/ComfyUI_Text_Tools_SG
      

      then restart ComfyUI. No pip dependencies, no models, no GPU.

      And the pack-wide warning you'll see in every one of these articles: on ComfyUI 0.3.76+, disable Nodes 2.0, because this pack's custom frontend widgets aren't ported to the new Vue renderer. For this node specifically the saving logic is pure backend Python, so files will still land even with Nodes 2.0 on - but the UI reporting can get flaky, and you're here for a clean workflow.

      Two real-world gotchas: the counter always starts at 1 and scans for the first free number, so saving ten files, deleting the middle one, and saving again will reuse that number. And there's no check on the source - whatever string comes in gets written, so if you're saving JSON that was already pretty-printed upstream, leave pretty_json off unless you want a double-format. Small pack, solo maintainer, MIT license. For "generate text, keep it," it's the least-surprising node in the pack.

      Categoryutils

      Inputs (4)

      NameTypeDefaultDescription
      textSTRING
      filename_prefixSTRINGComfyUI_text
      file_formatCOMBOtxt3 options: txt, json, md
      pretty_jsonBOOLEANtrue

      Outputs (0)

      No outputs