Save Text With Filename
Text to a file, named after the source image
- saved_path
This is the least glamorous node in the pack and the one you'll quietly be grateful for. It takes a string of text and writes it to a file whose name is derived from a source image. That's it. But if you're building a captioning pipeline - image in, vision model describes it, text out - this is the node that turns "a node outputted some text" into "a folder full of image_001.txt captions sitting next to image_001.png," which is exactly what a LoRA training run needs.
The design is built around the pack's Load Image With Metadata node. That node loads an image and exposes BASE_DIR and BASE_FILENAME, so the natural wiring is: load an image, run it through a captioner (the pack's Qwen3-VL node or a Local LLM works great), and pipe the resulting text plus those two string outputs into this node. Every source image gets a sidecar text file in the same folder, named after it. That's the whole game - and it's a very useful game when you're preparing a dataset and don't want to hand-rename a hundred files.
The inputs, all required:
text- the content to write. Multiline, so caption or prompt output drops straight in.base_dir- where the file goes. Wire this from Load Image With Metadata'sBASE_DIR.base_filename- the source filename, used to derive the output name. Again, from the load node.replace_extension(default true) - if on, the source extension (say.png) is swapped forextension(defaulttxt), sophoto.pngbecomesphoto.txt.extension(defaulttxt) - the new extension. Turnreplace_extensionoff and it just appends nothing, writing to the original filename instead.
There's a single output, saved_path (a string with the full path it wrote to) - handy if you want to log it or feed it somewhere else. The node is marked as an output node, meaning it writes to disk and is the end of its branch.
Mechanically it's as simple as it sounds: it splits base_filename on the extension, rebuilds the name, creates base_dir if it doesn't exist, and writes the text as UTF-8. No magic, no API calls, no GPU. It's one of the few nodes in this pack that works with zero API tokens - worth remembering when the pack's console starts complaining about missing env vars on load; this one doesn't care.
Install it the same way as the rest of the pack - ComfyUI Manager, search ComfyUI-API-DockerCPU, or clone it into custom_nodes:
cd ComfyUI/custom_nodes
git clone https://github.com/trustypangolin/ComfyUI-API-DockerCPU
cd ComfyUI-API-DockerCPU
pip install -r requirements.txt
Then restart and look under 🎨 DockerCPU API/Utilities.
The usual failure mode is wiring: forget base_dir and it writes to whatever empty string got passed, which either errors or lands somewhere you didn't expect. Feed it real BASE_DIR/BASE_FILENAME values from the load node (or hardcode them) and it just works. It's not the node you'll screenshot to show off a workflow - it's the node that makes the workflow actually finish its job.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| base_dir | STRING | — | |
| base_filename | STRING | — | |
| replace_extension | BOOLEAN | true | — |
| extension | STRING | txt | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| saved_path | STRING | — |