Nodes/ComfyUI_Text_Tools_SG/Text Tools Load Text json md From Anywhere (FilePath)-SG
ComfyUI Node

Text Tools Load Text json md From Anywhere (FilePath)-SG

Load a text file from anywhere on your disk, not just ComfyUI's folders

By ShammiG·Created 11 months ago·Updated 8 months ago· 8
Text Tools Load Text json md From Anywhere (FilePath)-SG
    • text_content
    ◄file_path►
    ◄info_textLoad text, Json, markdown file from anywhere. Right-click the file in File Explorer and select 'Copy as path' and paste in the box above. ►

    The pack's other loader only shows you files inside ComfyUI's own folders. Text Tools Load Text json md From Anywhere (FilePath)-SG doesn't care where the file lives - you type (or paste) an absolute path and it reads the .txt, .json, or .md file straight into the graph as a STRING. If you keep your prompt library or project notes on your desktop, in a synced folder, or on a second drive, this is the one you want.

    It's the sibling of "Text Tools Load Text Json md-SG" in the ShammiG/ComfyUI_Text_Tools_SG pack. Same reading logic, same JSON pretty-printing, same change detection - the only real difference is that instead of a folder dropdown plus a file dropdown, you get one path box. Which is both the feature and the tradeoff.

    The inputs

    • file_path - the absolute path to the file. The author's own guidance, baked into the node as its info_text: right-click the file in File Explorer, pick Copy as path, and paste it in. That's worth knowing because Windows' "Copy as path" includes surrounding quotes ("C:\...\file.txt"), and the node strips quotes automatically - so paste away.
    • info_text - informational, carrying the same instructions on the canvas. Ignore or edit it.

    The single output, text_content, is the file's contents as one STRING - feed it into CLIP Text Encode, a merge node, the Save Text node, anything.

    How it works

    Simple and honest: it strips whitespace and surrounding quotes, checks the path exists and is a file, verifies the extension is one of the three supported, reads it as UTF-8, and - like the folder-based loader - re-serializes any valid JSON with 2-space indentation so you get readable output. Failures don't crash the graph; they come back as an error string in the output (things like File not found: ...), which is either friendly or confusing depending on how closely you watch the node. It also tracks the file's modification time, so editing the file on disk and re-queuing re-reads it without touching the graph.

    Install and gotchas

    Same pack, same install - ComfyUI Manager (search ComfyUI_Text_Tools_SG) or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ShammiG/ComfyUI_Text_Tools_SG
    

    then restart. No pip dependencies, no models, no GPU needed.

    Now the two things that actually bite with a "load from anywhere" node:

    Path access. The path is resolved by the ComfyUI process, on the machine running it. If you're on a remote box, "anywhere" means anywhere that machine can see - a path you can browse locally won't work unless it exists on the server. And on Windows, a path like C:\folder\file.txt in a JSON workflow can have its backslashes mangled by escaping; the node strips quotes but not all of the surrounding mess, so if it comes back "File not found", double-check you're not pasting a URL or a path with doubled backslashes.

    The Nodes 2.0 warning, again. This is pack-wide and it's the README's opening notice: on ComfyUI 0.3.76+ keep Nodes 2.0 disabled, since the custom frontend widgets aren't ported to the new renderer. The file-reading backend runs regardless, but the widget's behavior is a legacy-canvas thing.

    Honestly, this node is the underdog of the pack - barely any search impressions, no fanfare - but for the "my prompts live in a git repo / on my desktop" crowd it's the right loader. The dropdown version is prettier; this one is for when the file isn't in a folder ComfyUI recognizes.

    Categoryutils

    Inputs (2)

    NameTypeDefaultDescription
    file_pathSTRING—
    info_textSTRINGLoad text, Json, markdown file from anywhere. Right-click the file in File Explorer and select 'Copy as path' and paste in the box above. —

    Outputs (1)

    NameTypeDescription
    text_contentSTRING—