LogicUtil_Save Text Custom Node
Write any text to a .txt file mid-workflow
- text
- STRING
ComfyUI is great at producing images and genuinely terrible at remembering what you asked for. The metadata goes into the PNG, sure, but if you're running a batch of variants and want a clean text file per run - the exact prompt, the CFG, the denoise, whatever string you care about - this node will write it to disk while the workflow is still going. It's the "Save Text Custom Node" from the LogicUtil subpack of ComfyUI-JDCN, and for logging and batch bookkeeping it's genuinely handy.
What it does
You feed it any text value (prompt, JSON, a number turned into a string, output from another node) and it writes that text to a .txt file in ComfyUI's output folder. The text input is the wildcard * type, so it accepts a string from anywhere - a prompt template, a list join, whatever. No conversion step needed, it just stringifies what you give it.
The inputs that matter
Only three things to set, honestly:
filename- the actual file name (no extension needed). This one is required in practice: the node asserts it's non-empty, so leaving it blank throws an error rather than inventing a name for you.filename_prefix- defaults toComfyUI, and gets glued to the front of your filename. Set it to something meaningful likebatch12_if you want grouping.subfolder_dir- optional subfolder insideoutput/to keep things tidy. Blank writes to the output root.
The file that lands is output/<subfolder_dir>/<filename_prefix><filename>.txt. So prefix=ComfyUI, filename=myrun gives you ComfyUI/myrun.txt.
The single STRING output is the filename that was written (the code builds it without the .txt), which is useful if you want to chain the result into a logging node or a subsequent step.
Where people get burned
Two things worth knowing before you wire it in. First, that filename assert: the node does not auto-generate a unique name or append a counter, unlike ComfyUI's built-in save nodes. Every run with the same filename overwrites the previous file. That's either a feature (a "latest prompt" file you can tail) or a footgun (you silently lose run one), depending on your workflow.
Second, a caveat from reading the actual source: the shipped code has a stray counter += 1 at the end of the save function with no counter defined, which can throw a NameError after the file is already written. So if a run errors out but the .txt magically exists anyway - that's why. It may be patched in the version you're on, but don't be shocked if you see it.
Installing it
This node ships inside the ComfyUI-JDCN pack, so installing the pack gets you all the LogicUtil nodes at once. Easiest path is ComfyUI Manager: Manager → Install Custom Nodes → search "JDCN" → install ComfyUI-JDCN, then restart ComfyUI. Or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/daxcay/ComfyUI-JDCN.git
cd ComfyUI-JDCN
pip install -r requirements.txt
The pack's only real dependency is piexif, so there's no model download and nothing heavy. It's a small, two-person utility pack (Daxton Caylor and Jerry Davos), and its file-handling nodes get recommended around r/comfyui for exactly the "get data out of the graph" use cases this node serves. Not the flashiest node in your library, but the day you need a prompt log, you'll be glad it's there.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| text | * | — | |
| filename_prefix | STRING | ComfyUI | — |
| subfolder_dir | STRING | — | |
| filename | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |