text_saveText
Write generated prompts (or anything) to disk mid-workflow
- status
You ran a wildcard sweep and now you want a record of exactly which prompt produced that batch - but ComfyUI only saves the last prompt in the PNG metadata. text_saveText is the "write this string to a file" node: feed it any text, give it a path, and it dumps the file as part of the workflow run. Think of it as a poor man's run log, and it's genuinely the right tool for it.
It lives in ComfyUI-Apt_Preset, the cardenluo mega-pack. Most of that pack is about collapsing workflows into loaders and samplers; this node is one of the small utilities that makes the pack feel complete. English docs are thin, but this one needs no manual.
How it works
content (multiline) gets written to disk. file_path is the target - it can include a filename, and if the parent directory doesn't exist it's created for you. file_type picks the extension and, for two types, changes behavior:
- json - parses
contentas JSON and writes it pretty-printed with UTF-8. Invalid JSON falls back to writing raw text. - toml - same deal via the
tomlpackage. - text / md / js / py - written as-is, encoding UTF-8.
If the file at file_path doesn't exist yet, it auto-generates a name: output_YYYYMMDD_HHMMSS.txt (or whatever extension matches file_type), in the directory you specified. That's the "never overwrite" safety net - if you give an existing path, it overwrites, so timestamped logging means giving it a folder and letting it name files.
The optional custom_file_name overrides the naming entirely (extension still added from file_type). Handy when you want a stable name per run, like frame_003.
Inputs and outputs
- content - the string to save.
- file_path - folder and/or filename. Empty is not allowed: it raises and kills the run.
- file_type -
text,md,json,js,py,toml. - custom_file_name - optional.
- Output: status, a string like
成功:文件已保存至 <path>(the success message is Chinese; that's the pack). Wire it to a text display or ignore it.
Installing it
Same pack, same drill. ComfyUI Manager → search ComfyUI-Apt_Preset, or:
cd ComfyUI/custom_nodes
git clone https://github.com/cardenluo/ComfyUI-Apt_Preset
Restart, run install.bat on Windows for the pack's requirements (openpyxl and toml are in there - toml is actually needed by this node). The rest of the dependency list is heavy but mostly for other nodes.
Common issues
The empty-path error is the main footgun - the node validates before writing, so a blank file_path stops the whole run. Double-check you're not passing a relative path that resolves nowhere. And remember it's a plain disk write: no overwrite guard on existing files, so if you save to the same path across runs you're clobbering the previous one. That's exactly why the timestamped auto-name exists - use a folder path and let it version for you.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| content | STRING | — | |
| file_path | STRING | — | |
| file_type | COMBO | 6 options: text, md, json, js, py, toml | |
| custom_file_nameopt | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| status | STRING | — |