Nodes/ComfyUI Easy Use/easy saveText
ComfyUI Node Runs on cloud

easy saveText

Write a string to a text file from inside your workflow

By yolain·Created 3 years ago·Updated 12 days ago· 2,647
easy saveText
  • image
  • text
  • image
text
output_file_path
file_name
file_extension
overwritetrue

ComfyUI is great at saving images and weirdly quiet about saving text. easy saveText closes that gap: hand it a string, a folder, and a filename, and it writes a text file to disk. Not glamorous, extremely handy - especially once you start generating captions, prompts, or logs and want them on disk next to the images instead of trapped in the graph.

The obvious pairing is with a captioner or interrogator. Run easy imageInterrogator or a JoyCaption node, pipe the result here, and you've got a .txt sitting beside each image - which happens to be exactly the format LoRA training tools expect for caption files.

How it works

It takes the text string and writes it to output_file_path/file_name.file_extension. It also passes the text straight back out (and optionally an image through), so you can keep the string flowing to other nodes and save it in the same hop rather than dead-ending the wire.

The inputs and outputs that matter

  • text - the string to write. Wire it from whatever produced it.
  • output_file_path - the folder to save into.
  • file_name - the base filename (no extension).
  • file_extension - the extension to append (e.g. txt).
  • overwrite (default true) - true replaces an existing file of that name; false protects it. Watch this one (see below).
  • Optional image - pass an image through alongside, e.g. so a downstream save node handles both.
  • Outputs: text (the same string, to keep chaining) and image (the passthrough).

How to install it

ComfyUI Manager: search ComfyUI-Easy-Use, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/yolain/ComfyUI-Easy-Use

then install.bat / pip install -r requirements.txt, restart. No models.

Common issues & troubleshooting

It silently overwrote my file. overwrite defaults to true, so a fixed file_name rewrites the same file every run. If you're saving one caption per image and they all share a name, you'll end up with a single file that only holds the last one. Either vary the filename per item or set overwrite false.

Nothing got written / permission error. The output_file_path has to exist and be writable by the process running ComfyUI. On a hosted or containerized ComfyUI (like running on a cloud GPU), the filesystem may be ephemeral or restricted - write somewhere your setup actually persists, and don't assume an absolute path from your local machine exists on the server.

One file when I wanted many (or vice versa). If text arrives as a list (say, a per-image caption list) but your filename is constant, saves collide. Drive the filename from an index or the source name so each item lands in its own file.

Building training caption files. For a LoRA dataset you want one .txt per image, named to match the image. Feed a per-image caption in as a list and vary file_name accordingly - then the paired image/text files line up the way trainers expect.

CategoryEasyUse/Logic

Inputs (6)

NameTypeDefaultDescription
textSTRING
output_file_pathSTRING
file_nameSTRING
file_extensionCOMBO2 options: txt, csv
overwriteBOOLEANtrue
imageoptIMAGE

Outputs (2)

NameTypeDescription
textSTRING
imageIMAGE