Nodes/EBU Workflow/EBU Read From File
ComfyUI Node

EBU Read From File

Pull a text file into your graph

By burnsbert·Created about a year ago·Updated 12 months ago· 0
EBU Read From File
    • file_contents
    directory_namestore
    file_nameoutput.txt

    EBU Read From File reads a text file from disk and hands its contents to the rest of your graph as a string. It's the reading half of the EBU Workflow pack's little text-file subsystem - the writing half is EBU Append To File, and the clever middle child is EBU File List Cache. On its own it's boring; wired with its siblings it's how you persist state between ComfyUI runs.

    The scenario: you log prompts and seeds with Append To File, then in a later session you want those back inside the graph - to review, to feed a prompt node, to drive a search. This node is the door.

    How it works

    You give it directory_name (default store) and file_name (default output.txt), it joins them, reads the whole file, and returns the contents as the file_contents (STRING) output. Notably, it's marked as an output node, so you can also just use it to display file contents in the UI via a text view without wiring anything.

    The graceful part: if the file doesn't exist, it doesn't crash. It prints File not found: <path> to the console and returns an empty string. That's deliberate, and it means you can wire this node into a workflow before the file is ever created without the whole graph going red.

    Inputs and output

    • directory_name (STRING, default "store") - folder, relative to ComfyUI's working directory.
    • file_name (STRING, default "output.txt") - the file.

    Output: file_contents (STRING) - the entire file as one string, newlines included.

    The path gotcha (same as its sibling)

    Relative paths resolve against ComfyUI's working directory - usually the ComfyUI root, not ComfyUI/output. So to read what EbuAppendToFile wrote with its defaults, this node's defaults are already right: store/output.txt. If you moved things with absolute paths on the write side, use the same absolute path here. Mismatched paths are the classic "reads an empty string" mystery, because the missing-file behavior is silent by design.

    Where it fits

    • Read back a log file you built across many runs, then hand the contents to a text display or a prompt node.
    • Read a config or a saved prompt list from disk at workflow start - useful if you keep per-project files outside ComfyUI's UI.
    • Pair with EBU File List Cache as a sanity check: read the cache file directly to see what's in the pool.

    One caveat on scale: it slurps the whole file into one string. A 5 MB log in one string is fine for display but a bad idea to pipe into a text encoder. Keep log files modest.

    Installing

    Standard EBU Workflow install - no dependencies beyond Python's standard library, no models. ComfyUI Manager (search "EBU Workflow"), or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/burnsbert/ComfyUI-EBU-Workflow
    

    then restart ComfyUI.

    Gotchas

    • Missing file = empty string, not an error. If you're debugging "why is my prompt blank," check the path and the console message first.
    • UTF-8 only. A file with a different encoding will throw during the read, and the empty-string fallback doesn't cover that case.
    • Relative paths are relative to ComfyUI's working directory, not your workflow's location. Absolute paths are your friend once the defaults stop fitting.
    CategoryUtility

    Inputs (2)

    NameTypeDefaultDescription
    directory_nameSTRINGstore
    file_nameSTRINGoutput.txt

    Outputs (1)

    NameTypeDescription
    file_contentsSTRING