Save String KJ
Write text to disk like you'd save an image
- filename
Every ComfyUI workflow that saves images has a Save Image node as a matter of course. This is the same idea for text - the final prompt an LLM node generated, a caption, a log line, whatever string value you want a permanent record of - dropped straight into your output folder as a file, no extra scripting required.
The obvious use case is pairing it with anything that generates or transforms text mid-workflow: an LLM/API node producing an enhanced prompt, a captioning model, a template filled in with per-run values. Wire the resulting string into this node and you get a durable record of exactly what was used for a given generation - useful the day you want to reproduce a result and can't remember what actually went into it.
The inputs and outputs that matter
string- the text to save. This is the only truly required content input.filename_prefix(default "text") - the base name your saved files get.output_folder(default "output") - where it lands, relative to your ComfyUI output directory.file_extension(optional, default ".txt") - keep the leading dot; typing the extension without it produces an odd filename liketext_00001txtrather thantext_00001.txt.- Output:
filename- the string, so you can chain the actual saved filename into a logging step or another node downstream; it's also an output node, so it's a valid endpoint on its own.
How to install it
Standard KJNodes install: ComfyUI Manager → search "KJNodes for ComfyUI" → install, or manually - cd ComfyUI/custom_nodes && git clone https://github.com/kijai/ComfyUI-KJNodes, pip install -r ComfyUI-KJNodes/requirements.txt, then restart. Pure file I/O, no extra dependencies or model downloads for this one.
Common issues & troubleshooting
Files silently pile up without overwriting. Like ComfyUI's other Save-style nodes, repeated runs with the same filename_prefix don't clobber the previous file - you'll get an incrementing counter instead. That's usually what you want, but it's worth knowing before you assume a run "didn't save" just because you don't see a file named exactly what you expected.
output_folder is relative, and an unusual value can land somewhere you didn't intend. It's relative to your ComfyUI output directory, not an absolute filesystem path - if you type something with ../ in it or an odd nested path, you can end up creating subfolders in places you weren't picturing. Leave it at the default "output" unless you specifically need to organize saved text into subfolders and know exactly what path you're asking for.
Forgetting the dot on file_extension. Small thing, easy to trip on: .txt is right, txt produces a malformed filename. If your saved files look wrong, this is the first thing to check.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| string | STRING | string to save as .txt file | |
| filename_prefix | STRING | text | The prefix for the file to save. This may include formatting information such as %date:yyyy-MM-dd% or %Empty Latent Image.width% to include values from nodes. |
| output_folder | STRING | output | Subfolder within the ComfyUI output directory to save to. Paths resolving outside the output directory are rejected. |
| file_extensionopt | STRING | .txt | The extension for the saved file. Limited to plain-text/data formats. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| filename | STRING | — |