EBU PromptHelper Load File as String
Load a prompt template straight off disk
- STRING
Load File as String is the pack's bridge between your text editor and your graph. It reads a file from disk using UTF-8 and hands the entire contents back as a single STRING, ready to feed into a prompt, a Combine Two Strings node, or anywhere else text flows. If you keep your carefully-tuned prompt templates in .txt files - the way people keep wildcard libraries and reusable prompt blocks on disk - this is the node that pulls them in without you copy-pasting a wall of text into a widget.
How it works
Mechanically it's the simplest thing in the pack: open(path, encoding='utf-8'), read the whole file, return it. You supply two inputs - directory (the folder path) and file_name - and the node joins them with os.path.join. One detail that matters for how it behaves on failure: if anything goes wrong (file not found, bad path, encoding error), it prints the error to the ComfyUI console and returns an empty string rather than crashing. That's a deliberate design choice - the node is meant to be embedded in a graph where a missing template shouldn't take down the whole run, and an empty string flows through the rest of your prompt pipeline harmlessly.
The inputs and output
- directory - the folder containing the file. A full path (e.g.
C:\ComfyUI\promptsor/home/me/prompts) or relative, depending on where you run ComfyUI. - file_name - the file's name, e.g.
character_block.txt.
Output: a single STRING with the file's raw contents. That's it - no trimming, no encoding conversion beyond UTF-8, no line processing. What you wrote is what you get, including trailing newlines. If your file has a BOM or non-UTF-8 characters (like a Windows-1252 apostrophe), expect a decode error and an empty string back.
Where it fits
This is the node to grab when you want to version-control or edit prompts outside ComfyUI, or when the same template block gets reused across many workflows. Keep character_block.txt and scene_block.txt on disk, load both with two of these nodes, and merge them with Combine Two Strings. It also plays nicely with the pack's Replace/Randomize nodes: load a template containing placeholders like MY_COLOR1 and let the rest of the graph fill them in each run. That's a clean way to keep the "random prompt" pattern without cramming a huge template into a widget you have to scroll.
Install
Part of EBU PromptHelper. ComfyUI Manager: search "EBU PromptHelper", or:
cd ComfyUI/custom_nodes
git clone https://github.com/burnsbert/ComfyUI-EBU-PromptHelper
then restart ComfyUI. No models, no extra dependencies - this pack is pure Python standard library, and file reading is core stdlib.
Troubleshooting
The empty-string-on-error behavior is the thing that will confuse you first, because the failure is invisible in the graph. If your prompt comes out blank or a downstream node gets nothing, check the ComfyUI console for the Error reading file: line - it tells you exactly what went wrong. Common causes: wrong directory path (especially on Windows, where backslashes in a path you paste may need care), the file being saved with an encoding other than UTF-8, or a trailing newline in directory/file_name from copy-paste. Also note this node does not resolve paths relative to your ComfyUI folder automatically - the directory you give is joined and opened as-is.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| directory | STRING | — | |
| file_name | STRING | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |