Text Saver JNK
Write generated text to a file without stomping your last good copy
ComfyUI can generate a lot of text these days - translated captions, LLM-written prompts, batch configurations - and stock ComfyUI has surprisingly little patience for "just save this string to a file." "Text Saver JNK" is that node: take a string, write it to an exact path on disk, with an overwrite policy so a re-run doesn't silently destroy the version you liked. The pack README calls it out for saving translations and configuration sets, and it does exactly that.
The mechanism is small but the overwrite dropdown is the whole point, so it deserves attention. Three modes:
- all - always write, clobber whatever's there.
- empty (default) - only write if the existing file is effectively empty (smaller than a few bytes). This is the safe-for-batches mode: first run writes, re-runs leave your saved copy alone unless it was a blank file.
- skip - never touch an existing file at all.
That default of "empty" is a thoughtful choice, because it makes the node idempotent in the way people actually want: you can re-run the graph a dozen times and the file stays at the version that first landed, which is usually the good one. Combine it with clear, which is a text-hygiene toggle: when on, it strips quote characters and leading/trailing punctuation and spaces before writing. That's aimed at cleaning up strings that came out of an LLM wrapped in markdown or quotes - "hello," becomes hello before it hits disk.
The inputs:
- text - the string to save.
- path - full file path, including filename. Parent directories are created for you, which is a quiet convenience.
- overwrite - all / empty / skip, the safety policy.
- clear - strip quotes and edge punctuation first.
No outputs - it's a pure sink. You wire a string in and a file appears.
Install: ComfyUI Manager → search "JNK" → Install, then restart. Or:
cd ComfyUI/custom_nodes/
git clone https://github.com/Aljnk/ComfyUI-JNK-Tiny-Nodes.git
Then restart. Zero extra dependencies - this is stdlib file I/O.
Gotchas: the clear cleanup is specific - it strips double quotes and a set of punctuation characters from the ends, but doesn't touch interior characters, so it won't fix a mid-string mess. If text isn't actually a string the node raises a TypeError and your run fails loudly, which is better than writing junk. And empty mode's threshold is "smaller than about 3 bytes," so a file containing just a\n counts as non-empty and won't be overwritten - if you want to force a fresh write, switch to all or delete the file. One more: nothing logs which mode it took, so when you're debugging "why didn't my file update," check the overwrite setting before suspecting the node. For configuration files and translations that you regenerate in batches, this is the safe way to land them.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| path | STRING | — | |
| overwrite | COMBO | empty | 3 options: all, empty, skip |
| clear | BOOLEAN | false | — |
Outputs (0)
No outputs