Load Text Asset File
Drop a text file into ComfyUI from the browser, then feed it to any prompt box
- STRING
The name undersells it. "Load Text Asset File" sounds like a boring file reader, but the whole point of this node is the upload button that comes with it. It lets you push a text file straight from your browser into ComfyUI's input folder - no SSH, no file manager, no shared drive - and then hands the file's contents out as a plain STRING you can wire into anything.
If you keep your prompt blobs, negative-prompt libraries, or style blocks in .txt files instead of pasting them into a text widget every session, this is the node that reads them back. It's genuinely handy on a headless box or a Docker setup where getting files in and out is normally a chore. The reader is stuck and wants help; this one is small but it does one job and does it with a button.
How it works
On first use, the node creates a textassets folder inside your ComfyUI input directory. The textasset dropdown then lists every file it finds there. Hit the upload button and the bundled JavaScript POSTs your chosen file to a /upload/textasset endpoint this pack registers with ComfyUI's server, which drops the file into that same folder. The node then opens it, reads it, and returns the text.
The inputs that matter
Only one really: textasset, the dropdown of files in input/textassets/. The other two are small toggles:
overwrite(0/1, default 0) - when off, a name collision is saved asname_(1).txtinstead of clobbering the old file. Flip it to 1 if you'd rather always replace.show_content(0/1, default 1) - shows a read-only preview of the file's text on the node. It's a work in progress (the code literally appends "(TODO)" to the preview), so treat it as a peek, not an editor.
The single output is a STRING with the whole file contents - wire it into any text input, like a CLIP Text Encode or a prompt-to-image node. IS_CHANGED returns the file's contents, so editing the file reruns anything downstream instead of caching stale text.
Installing it
The whole pack is one node, one Python file, no requirements.txt, no models, no API keys. Either search "ComfyUI_TextAssets" in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/bilal-arikan/ComfyUI_TextAssets
Then restart ComfyUI. That's it.
Gotchas
The save handler has a genuine bug: it writes received_file.file.readline(), which is one line. Upload a multi-line file through the button and only its first line survives on disk - you'll wonder why your prompt got truncated. The workaround is to copy multi-line files into input/textassets/ on the server yourself (or check the repo for a fix before relying on it). Default overwrite = 0 also means the dropdown accumulates prompt_(1).txt duplicates if you keep re-uploading the same filename. Both are small annoyances, not deal-breakers, but know them going in and this tiny node is painless.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| textasset | COMBO | 0 options: | |
| overwrite | INT | 00–1 | — |
| show_content | INT | 10–1 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |