Load Text File
Load a .txt straight into your graph
- content
- lines
Got a prompt, a negative list, or a settings file sitting on disk that you keep copy-pasting into your workflow? Load Text File reads a .txt file straight into the graph and hands you the whole content plus a line-split list. It's the node that turns "edit the text file, not the workflow" into reality - keep your long prompts or tag lists in a file, edit them there, and let the workflow just reference it.
It's part of DebugPadawan's ComfyUI Essentials, a pure-Python utility pack. The mechanism is a plain open(file_path, 'r', encoding='utf-8') call - no models, no GPU, no external service.
How it works
One required input:
file_path- the path to the file (STRING, default"example.txt")
Two outputs:
content- the entire file as one STRINGlines- the same text split into a LIST of lines (viasplitlines(), so no trailing newline junk per entry)
The path handling is the thing to understand: it uses whatever path you give it, resolved relative to ComfyUI's current working directory - which is typically the directory you launched ComfyUI from (usually the ComfyUI root). So file_path = "prompts/negative.txt" reads ComfyUI/prompts/negative.txt, and an absolute path like /home/you/notes.txt works too.
Two friendly behaviors worth knowing: if the file doesn't exist, it returns "File not found: <path>" as the content (and an empty list) instead of crashing the graph. And if reading throws for another reason, you get "Error loading file: <detail>". Neither halts your workflow - which is convenient, but it does mean you can silently run with an error string in your prompt if you don't look.
Where you'll use it
- Long prompts and negative lists kept in editable text files.
- Batch tag lists - split on newlines and feed
linesinto a list selector orText Joiner. - Config-ish data loaded at runtime instead of hardcoded.
Installing it
Whole pack, one install. ComfyUI Manager, searching for "DebugPadawans-ComfyUI-Essentials," or:
cd ComfyUI/custom_nodes
git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials
Then restart ComfyUI. Requirements (numpy, torch, opencv-python) are already in stock ComfyUI; no model downloads. Don't confuse the pack with cubiq's "ComfyUI Essentials" when searching Manager - different, larger pack, in maintenance mode.
Gotchas
- Relative paths are relative to ComfyUI's working directory, not to your workflow file. If ComfyUI is launched from elsewhere, relative paths resolve elsewhere. Use absolute paths when in doubt.
- Missing file doesn't error - it returns an error string. If your prompt looks wrong, check the
contentoutput; a"File not found"string in there is the tell. - UTF-8 only. A file in a different encoding will produce the "Error loading file" fallback.
- It's a small, quiet pack - no big community writeups, but the behavior is plain enough to trust from the source.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| file_path | STRING | example.txt | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| content | STRING | — |
| lines | LIST | — |