ComfyUI Node Runs on cloud

Save Text File

Write a string to disk from ComfyUI

By WASasquatch·Created 3 years ago·Updated about a year ago· 1,812
Save Text File

      Save Text File writes a text string to a file on disk. That's it, and that's plenty - once you're generating text inside a workflow (captions, prompts, logs, metadata), you eventually want to keep it, and ComfyUI's core has no clean way to do that. This node fills the gap.

      Where it earns its keep: you're batch-generating images and want the prompt saved next to each one. Or you ran BLIP to caption a folder of references and want those captions written out. Or you're building a dataset and need the text labels on disk. Anywhere a string needs to leave ComfyUI and become a file, this is the exit door.

      How it works

      You give it the text to save and tell it where to put it - a path, a filename - and it writes the string out. A nice touch specific to WAS: it supports text tokens in filenames, the same token system the Save Image node uses. So you can name files dynamically with things like [time(%Y-%m-%d)] for a datestamp or [hostname], and even define your own tokens with the Text Add Tokens node. That makes it easy to write uniquely-named files across a batch instead of clobbering the same one every run.

      The inputs and outputs that matter

      The essentials are the text you want to write, the path (the folder), and the filename. There's typically a control for the file extension/format and a delimiter option too. It's an output node, so its job is the side effect - the file on disk - rather than passing data onward. Point it at a real, writable folder and feed it the string from whatever produced your text (a caption node, a prompt node, a text concatenate).

      How to install it

      Comes with WAS Node Suite. Install once via ComfyUI Manager (search WAS Node Suite, install, restart) or clone it:

      cd ComfyUI/custom_nodes
      git clone https://github.com/WASasquatch/was-node-suite-comfyui
      pip install -r was-node-suite-comfyui/requirements.txt
      

      then restart. On Windows portable, run the pip step with python_embeded\python.exe -s -m pip install -r ... (or install.bat). No models - it's file I/O.

      Common issues & troubleshooting

      Nothing gets written / permission errors. The path has to exist and be writable by ComfyUI. On Linux or a non-admin Windows account this is a real gotcha - the WAS README specifically calls out needing write permissions on the relevant folders. If no file appears, check the console for a permissions error and point the node at a folder you can actually write to.

      Every run overwrites the same file. If you use a static filename, each run clobbers the last. That's what the token system is for - put a [time] or [time(%Y-%m-%d__%I-%M%p)] token in the filename so each save is unique. This is the single most common "where did my files go" cause: they didn't go anywhere, they overwrote each other.

      The token didn't expand. Tokens go in the filename and follow WAS's token format (built-ins like [time], [hostname], [cuda_device], plus any you add via Text Add Tokens). If a token comes out literal, check the syntax against the README's token list - a malformed token is written as-is rather than expanded.

      Wrong file contents on a batch. If you're saving per-image text across a batch, make sure the text feeding this node actually updates per item - a static upstream string writes the same content to every file regardless of the filename.

      The suite won't import. WAS Node Suite is large and unmaintained since late 2023; the recurring failure is an "Import Failed" after a ComfyUI update, from a dependency version clash (opencv especially). Reinstall the requirements against your ComfyUI Python and restart.

      Categoryx

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs