Nodes/lf-nodes/Save text
ComfyUI Node

Save text

The archive node for every string in your workflow

By lucafoscili·Created 2 years ago·Updated 7 days ago· 35
Save text
  • ui_widget
  • text
text
filename_prefix
add_timestamptrue
add_countertrue

ComfyUI is great at forgetting strings. Your final prompt, the caption an LLM just wrote, the JSON you serialized - they live in widgets and die when the workflow closes. LF_SaveText is the boring, correct fix: it takes any text from your graph and writes it to disk as a .txt file, with a little tree widget that confirms the save and shows you the exact path.

It's from lf-nodes, the UX-first suite by lucafoscili. Where core ComfyUI gives you a Save Text that's minimal to the point of uselessness for archiving, this one wraps the write in the same path-handling machinery as the built-in Save Image node - timestamps, counters, subdirectories - so your outputs don't collide and don't bury themselves in the wrong folder.

How it works

Under the hood it's almost embarrassingly simple: normalize the text, resolve a file path, and write it with UTF-8 encoding. The polish is in the details. It uses ComfyUI's own get_save_image_path helper for filename resolution, so the filename_prefix conventions you already know from Save Image apply. When it finishes, it sends a small tree structure to a frontend widget - "TXT saved successfully!" with the full output path nested underneath - so you get visible confirmation instead of a silent side effect. The node also returns the text, which makes it a perfectly good "terminal" node in a plumbing-heavy graph: last in line, holds the value, writes the artifact.

The inputs that matter

  • text (STRING) - whatever you're archiving. Prompts, LLM output, serialized JSON, a CSV of tags. If it's a string, it saves.
  • filename_prefix (STRING) - path and filename. Use slashes to create subdirectories under ComfyUI/output; e.g. captions/batch1 lands in output/captions/batch1.txt. Empty uses the default folder.
  • add_timestamp (BOOL, default true) - appends a date-time suffix so re-runs don't clobber each other.
  • add_counter (BOOL, default true) - appends _1, _2, ... until it finds a free name. With both on, you can queue the same workflow a hundred times and keep every artifact.

Output is text (STRING), a pass-through of what you saved.

Install

Same pack for everything LF:

  • ComfyUI Manager: search "LF Nodes", install, restart.
  • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/lucafoscili/lf-nodes.git, restart.

No models, no special downloads. The pack ships a long requirements.txt, but it's all auto-handled by Manager and mostly serves the filter/LLM/analytics nodes rather than this one.

Common issues

  • The saved file isn't where you expected. Check ComfyUI/output first - the prefix is relative to the output root, and slashes in it create subfolders.
  • You keep overwriting the same file. Leave add_timestamp and add_counter on, or give the prefix a unique name. Turning both off means a fixed filename that stomps on whatever's there - sometimes that's exactly what you want, but it's rarely a surprise you enjoy.
  • Still on the archived repo. If you installed this pack before late 2025, you may be on the old comfyui-lf repo, which was archived and replaced by lucafoscili/lf-nodes. Reinstall from the current repo so you're not missing a year of fixes and new nodes.
Category✨ LF Nodes/IO Operations

Inputs (5)

NameTypeDefaultDescription
textSTRINGPlain text data to save (.txt).
filename_prefixSTRINGPath and filename for saving the text. Use slashes to set directories.
add_timestampBOOLEANtrueAdd timestamp to the filename as a suffix.
add_counterBOOLEANtrueAdd a counter to the filename to avoid overwriting.
ui_widgetoptLF_TREE[object Object]

Outputs (1)

NameTypeDescription
textSTRINGSaved text.