Save Text @Liam
Write any string to a file next to your outputs
- STRING
Text that vanishes when a workflow finishes is a recurring annoyance - an LLM writes a prompt, a captioner produces a description, and unless you grab it from the UI, it's gone. This node fixes that: it takes a string and writes it to a .txt file on disk, so your generated text lives next to your generated images. It's the text equivalent of a Save Image node, built for exactly the "keep the LLM output" use case.
One thing to get out of the way early: the path is relative to your ComfyUI output folder, not anywhere absolute. The default directory is tmptxt and the default file_name is name.txt, so out of the box your text lands in ComfyUI/output/tmptxt/name.txt. Set both fields to something meaningful and it becomes a tidy, repeatable place to collect captions and prompts.
The inputs that matter
text- the string to save, forced input, so wire it from any text source (an LLM node, Merge Text, a wildcard output).directory- the subfolder underComfyUI/outputwhere the file goes (defaulttmptxt). The node creates it if it doesn't exist.file_name- the filename, including extension (defaultname.txt).
Output: one STRING, the text passed through unchanged - so you can save and keep feeding the value onward in the same graph.
How it works
It resolves the path to output/<directory>/<file_name>, creates the directory if needed, and writes the text with plain file-write mode. That means overwrite, not append - every run replaces the file. If you're generating per-image captions in a batch, give the filename something that varies per run or you'll be clobbering the previous one.
Installing it
Ships in LiamUtil:
cd ComfyUI/custom_nodes
git clone https://github.com/ai-liam/comfyui-liam
pip install -r requirements.txt
or via ComfyUI Manager (search LiamUtil) + restart. Only dependency is opencv-python; file-writing itself needs nothing extra.
Where people get burned
Location, location, location. Because the path is relative to the output folder and baked into the node's own code, a directory of tmptxt writes to ComfyUI/output/tmptxt/ - not to wherever you happened to be staring in your file browser. People go hunting in custom_nodes or their home folder first. Check output/ and you'll find it. Second, the overwrite behavior: a fixed filename means a batch of generations saves only the last one's text unless you vary the name. If the node isn't writing at all, confirm the output folder is writable and that text actually carries a value (a forced-input node with nothing wired produces an empty string, which writes an empty file - that's a wiring issue, not a save issue). For capturing one text blob per run, this is the node.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| directory | STRING | tmptxt | — |
| file_name | STRING | name.txt | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |