Iterator Load String
Read text files into your graph, one path at a time
- content
- filename
Iterator Load String is the text sibling of the pack's image loader: give it a file path, get the file's contents back as a STRING. The image half gets all the attention, but this is the node that batch-processes your prompts, captions, metadata, and configs instead of your pixels.
The workflow that makes it shine: a folder of .txt prompt files, each destined to drive the same pipeline. Iterator List Files (with extension set to txt) produces the list, file_paths wires into this node's file_path, and ComfyUI runs the whole downstream graph once per file - a different prompt through the sampler each time, one result per file. Same trick if the folder holds JSON, CSV, or markdown: the list node's default extensions already include all of them.
How it works
It reads the file, tries a chain of encodings until one decodes cleanly - utf-8-sig first (so BOM-marked files come out without the invisible garbage), then utf-16, then shift_jis, cp932, euc_jp, cp1252, latin-1 - and only falls back to UTF-8 with replacement characters if every encoding fails. That's the sort of detail most tiny string loaders get wrong. A BOM or a Japanese-encoded caption that makes other nodes cough up mojibake just works here.
Inputs and outputs
file_path(required, STRING) - sameforceInputdeal as the image loader: no text widget, you must connect a wire. There's no typing your way in. This consistently trips people up, so it's worth saying plainly: it's a connection-only input.
Outputs:
content(STRING) - the full text of the file. Whatever you'd do with a prompt string, do with this.filename(STRING) - the base name. Wire it to a Save Image filename or a text display so each output carries its source name.
Install
Same as the rest of the pack, which is to say painless. No model files, no dependencies - the requirements.txt is empty and the node only uses the Python stdlib. ComfyUI Manager (search "ComfyUI Iterator Nodes"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/AIMovieStudio/comfyui-iterator
Restart ComfyUI. Done.
Where people get burned
- It's raw text, not parsed data. A
.jsonfile comes back as a JSON string, not an object. If you want fields out of it, you'll need a JSON-parse node downstream. Same for CSV. - No widget on the path. Connect it, or stare at a dead input.
- Don't feed it a novel. The string flows into whatever's downstream and lands in UI text widgets; huge files make the graph slow and unwieldy. It's built for captions and configs, not books.
- Pairing text with images. If you're loading a caption file per image, remember List Files sorts both folders independently - if the names don't align, your captions and images won't either.
It's a small, quiet node from a small pack, and it doesn't need to be anything more. Folder of prompt files, list, load, sample. The whole batch pattern this pack sells reduces to exactly that.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| file_path | STRING | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| content | STRING | — |
| filename | STRING | — |