Teeth Load Text File
Read a Text File Into Your Workflow (Prompts, Captions, Config)
- text
Every serious ComfyUI setup eventually has prompts, captions, or configuration sitting in text files outside the graph - and a weird little fight about how to get them in. Teeth Load Text File is the straightforward answer: give it a folder and a filename, get the file's contents back as a STRING you can wire into a prompt encoder, a text display, or another node.
It comes from ComfyUI-Teeth, a small single-author utility pack with no real community footprint - which matters, because this node's behavior is simple enough that you mostly just need the file to exist. There are no models, no downloads, no API keys.
How it works
The node is a plain file read: os.path.join(folder, filename), opened for reading with the encoding you pick, contents returned as the text output. The only knobs are the path, the encoding, and an "always run" flag.
Encoding deserves a moment. The choices are utf-8 (default), gbk, latin-1, and ascii. gbk is there because the author is Chinese and gbk-encoded text files are common in that ecosystem - leave it alone unless you're reading a legacy Chinese file. If a file fails to decode, latin-1 is the "never fails, might mangle characters" fallback.
always_run is the one that will save your sanity. Off by default, it controls caching: the node hashes folder + filename + encoding and treats that as its change signal.
The gotcha nobody reads
The cache hashes the path, not the file's contents. Edit the file's contents, keep the same filename, re-run the graph, and ComfyUI happily serves the old text because the cache key didn't change. If you're iterating on a prompt file and your node won't pick up the changes, flip always_run on - it forces a fresh read every single run. That's what the flag exists for.
Also worth knowing: folder is used literally. There's no special-case for output here (unlike the pack's SaveTextFile), and a relative path resolves against ComfyUI's working directory - usually the ComfyUI install root - not against the input folder. If you're pointing at the wrong directory and getting "File not found," that's why.
Inputs and outputs that matter
- folder - path to the file's directory. Empty string means the ComfyUI root.
- filename - file name, including extension.
- encoding - utf-8 / gbk / latin-1 / ascii.
- always_run - force a re-read every run (see above).
- text (output) - the file's contents as a STRING.
There's a companion Teeth Save Text File in the same pack for writing back out - together they're a clean way to round-trip prompts and metadata to disk without touching the ComfyUI UI.
Common issues
- "File not found" - the path resolves somewhere you don't expect. Use an absolute path to be safe.
- UnicodeDecodeError - wrong encoding for the file. Switch to
latin-1as a last resort, orgbkfor legacy Chinese files. - Stale content on re-run - always_run is off. Turn it on.
Install
ComfyUI Manager: search ComfyUI-Teeth. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/steelan9199/ComfyUI-Teeth
Restart ComfyUI. Zero extra dependencies for this node - it's the standard library plus a bit of ComfyUI glue.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| folder | STRING | — | |
| filename | STRING | — | |
| encoding | COMBO | utf-8 | 4 options: utf-8, gbk, latin-1, ascii |
| always_run | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| text | STRING | — |