Save Anything As File ๐
Dump any wire value to a txt, json, or toml file
- data
ComfyUI is great at saving images and terrible at saving everything else. If you've generated a prompt, a caption, a config blob, or some LLM output on a wire and wanted it written to disk, you've probably hit that wall. This node is the fix: connect any value, pick a folder, a filename, and a format, and it writes the data to a .txt, .json, or .toml file. Simple, and quietly one of the more useful glue nodes in the pack.
Part of ComfyUI-MieNodes (ComfyUI_MieNodes), MieMieeeee's utility pack, in the Common group.
Why you'd use it
A few concrete cases. You used a prompt generator or CallLLMService to write a great prompt and you want to keep it, not lose it when the queue clears. You're building a LoRA dataset and want to save generated captions to disk. You've got a config or metadata structure you want serialized as JSON or TOML for another tool to read. In all of them, this node is the "write it out" step.
The format choice matters. txt for plain text (a prompt, a caption). json and toml for structured data - which pairs naturally with the pack's CompareFiles node, since that one diffs json/toml. Save two config states with this, diff them with that. It also fits the KB's LoRA-training reality that a lot of dataset and training work is really file wrangling around the model - having a clean way to emit text artifacts from your graph saves a round-trip out to a text editor.
The inputs and outputs that matter
All required:
data(any type) - the value to save. This is the "anything" - a string, a structured value, whatever's on the wire.directory- where to write it. The defaultX://path/to/folderis a placeholder; put a real path.file_name- the output name (defaultoutput).save_format-txt,json, ortoml. Pick the one that matches whatdatais: plain text โtxt, structured โjson/toml.
This is an output node - it has no outputs on the wire, it just performs the save when the graph runs. Think of it like a Save Image node, but for data.
Installing it
ComfyUI Manager โ search ComfyUI-MieNodes โ install โ restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/MieMieeeee/ComfyUI-MieNodes
then restart. No model download - it's a filesystem node. Nodes appear under the ๐ MieNodes menu.
Common issues
Format/data mismatch. Saving a plain string as json or toml can produce something odd or error, because those formats expect structure. If you're saving prompt text, use txt. Match the format to what's actually on the wire.
It writes to the ComfyUI machine's disk. On a serverless/cloud ComfyUI (comfy.icu included), that filesystem is ephemeral - the file may not survive after the run, and there's no persistent local folder to point at. This node shines on a local install where you control the disk; treat it accordingly in the cloud.
Placeholder path. X://path/to/folder won't work. Replace it with a real directory.
Overwrites. Reusing the same file_name and directory will overwrite the previous file. Vary the name (or the folder) if you want to keep every run.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| data | * | โ | |
| directory | STRING | X://path/to/folder | โ |
| file_name | STRING | output | โ |
| save_format | COMBO | 3 options: txt, json, toml |
Outputs (0)
No outputs