Josia文本保存
Save text to disk with a filename that timestamps and numbers itself
- image
- file_path
JosiaTextSave (Josia文本保存) is the "stop copy-pasting generated text out of the preview box" node. It takes any multiline string, writes it to a file, and - the part that makes it actually pleasant - handles the filenames for you with a small wildcard language. It's the natural end of a batch-prompt or LLM-in-ComfyUI workflow: the point where the workflow stops generating and starts leaving artifacts on disk.
What you set
Four required inputs, all of which double as normal widgets:
- text - the multiline content to save.
- output_path - the folder. Pick it with the built-in folder selector button (the frontend opens your OS file picker) or type it; the folder is created automatically if it doesn't exist.
- file_name - the base name, no extension, wildcards welcome.
- file_extension -
txtorcsv.
The wildcard rules, from the README, are paired %xxx% tokens:
%date%→2026-06-30%time%→07:38:41%date:yyMMdd%→260630%003%→ a 3-digit sequence starting at 003 that auto-increments;%0001%is a separate 4-digit counter so the two sequences don't interfere.
If the resolved filename already exists, it gets _001, _002 suffixes instead of overwriting. CSV files get a UTF-8 BOM written in, which sounds like trivia until you open the file in Excel and find the Chinese characters rendering as mojibake without it - that's a real nicety.
The image-filename trick
There's one optional input, image, and it's the sneaky good feature: wire an image in and the node reuses that image's original filename as the base name, gray-locking the file_name box. This is what makes the "multi-image load → caption → save" batch loop work so well - each caption lands in a .txt named after its source image, matching the pairing you need for training data. Same-name collisions still get the _001 suffix, so a folder with existing captions won't clobber anything.
Output
A single file_path (STRING) output carrying the resolved path, so a downstream node can log or display where the file actually landed - useful when wildcards mean you can't predict the exact name up front.
Install
Pure Python standard library, zero extra dependencies - only the folder picker needs the frontend JS, so the node degrades gracefully if web/js is missing (type the path instead). Part of ComfyUI_JosiaNodes:
cd ComfyUI/custom_nodes
git clone https://github.com/Josia-doit/ComfyUI_JosiaNodes
or ComfyUI Manager (search ComfyUI_JosiaNodes), then restart.
Gotchas
The README mentions a past bug where button serialization scrambled widget fields (paths leaking into text, wildcards jumping around) after a restart - the current version fixes that, but if you see a %003% doing something weird after reloading a workflow, a fresh reinstall is the known cure. And one honest limit: it writes text files, not images. Pair it with a Save Image node if you need both halves of a captioning run saved together.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | 要保存的文本内容,支持多行输入。 | |
| output_path | STRING | 📁 请选择输出目录… | 文件保存的文件夹路径。可点击上方「选择输出目录」在内置浏览器中挑选,也可直接输入/粘贴;文件夹不存在时自动创建。 |
| file_name | STRING | %001% | 保存的文件名,不含扩展名。支持通配符:%date%日期、%time%时间、%003%序号。 |
| file_extension | COMBO | txt | txt = 纯文本;csv = 每行一条CSV记录 |
| imageopt | IMAGE | 接入时自动复用原图文件名,文件名输入框灰化锁定。 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| file_path | STRING | — |