π½ Save Text
Write, append, or prepend a workflow's text output to a .txt file
Not every output of a ComfyUI workflow is an image. Sometimes you want to keep the actual text - a resolved prompt, a caption a node generated, a log line - as a plain .txt file you can open, grep, or hand to another tool. This is the pack's node for that: content in, file written, with five different modes for exactly how it lands relative to whatever's already in the file.
Why five write modes instead of one
A save-to-disk node could just overwrite the file every time and call it done, but that throws away the option to build something up across multiple runs - a running log of prompts you've used, a growing wildcard file, a caption you're assembling piece by piece. The five mode options cover both use cases:
new_file- overwrite whatever's there, starting fresh.new_line- appendcontentto the end as a new line, keeping history.join_string- appendcontentdirectly onto the end with no newline, for building up one continuous string across calls.new_first_line- insertcontentat the top as a new line, most-recent-first.join_first_string- prependcontentdirectly to the front, no newline.
That's a genuinely useful spread for anything iterative: run a workflow in a loop that generates prompt variations and accumulates them into a wildcard file with new_line, or keep a running "most recent result at the top" log with new_first_line.
The inputs and outputs that matter
content- the text to write.save_name- the filename, defaultfilename.txt.save_dir-input,output, orcustom.inputandoutputare ComfyUI's standard folders;customopens upcustom_dirfor an arbitrary path.custom_dir- only used whensave_diriscustom.mode- one of the five write behaviors above.
No outputs - this is a terminal, side-effect node. Check the target folder for the result.
Installing it
ComfyUI Manager: search SDVN_Comfy_node, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableDiffusionVN/SDVN_Comfy_node
Then pip install -r custom_nodes/SDVN_Comfy_node/requirements.txt from your ComfyUI root, and restart. This pairs naturally with the pack's Load Text node, which reads a .txt from the same folder conventions back in.
Where people get burned
Picking new_file when you meant to accumulate. This is the mode that most obviously bites - run a workflow you intended to build up a log with, but leave mode on new_file, and every run wipes out what came before. If you're doing anything iterative, new_line or new_first_line is almost certainly what you actually want.
Saving into input when you meant output, or vice versa. Since save_dir defaults to input, it's easy to end up writing your logs or generated text into the folder ComfyUI treats as source material for other load nodes rather than where your results should live. Double-check save_dir against what you're actually trying to build.
join_string/join_first_string with no separator of your own. Since these modes glue text directly together with no newline, repeated calls without adding your own delimiter in content (a comma, a line break character) will produce one long run-on string that's hard to parse back apart later.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| content | STRING | β | |
| save_name | STRING | filename.txt | β |
| save_dir | COMBO | input | 3 options: input, output, custom |
| custom_dir | STRING | β | |
| mode | COMBO | 5 options: new_line, new_file, join_string, new_first_line, join_first_string |
Outputs (0)
No outputs