Nodes/InstaSD nodes for ComfyUI/InstaSD - Check File Exists
ComfyUI Node

InstaSD - Check File Exists

A plain 'is this file there?' boolean for workflow logic

By WaddingtonHoldings·Created 2 years ago·Updated 10 months ago· 4
InstaSD - Check File Exists
    • boolean
    file_path
    file_name
    file_extension

    InstaFileExist answers one question - does this file exist on disk? - and returns True or False. It's a tiny logic node, not a passthrough, and unlike most of this pack it has nothing to do with InstaSD's API builder. It just checks the filesystem, which makes it useful for workflows that need to branch on state.

    Why would you want that? Any workflow that's doing batch or pipeline work and needs to decide whether to skip a step: "has this image already been generated?", "does the cached upscale exist?", "is the input still there?" Wire its boolean into a switch or a conditional, and you can skip expensive work instead of redoing it. In InstaSD-style deployments where a workflow runs headless or repeatedly, that kind of check is how you avoid regenerating what already exists.

    What you set

    • file_path - the directory, e.g. /path/to/folder. Required; the node throws if it's empty.
    • file_name - optional. If set, it's joined onto file_path (os.path.join).
    • file_extension - optional. If set, it's appended as .<extension> to whatever came before.

    So the three fields assemble into a full path: file_path + file_name + . + file_extension. You can supply just a directory and file name, or split the extension out if your file names vary. The output boolean (type BOOLEAN) is True only when the assembled path exists and is a regular file (not a directory).

    One detail that's actually the point of the node: it declares IS_CHANGED returning a fresh timestamp, which tells ComfyUI to never cache the result. Most nodes only re-run when their inputs change; this one re-checks the disk on every execution, so the boolean is always live even if the file appears or disappears between runs.

    Install

    cd ComfyUI/custom_nodes
    git clone https://github.com/WaddingtonHoldings/ComfyUI-InstaSD
    

    Restart ComfyUI, or use ComfyUI Manager (search "InstaSD"). The pack pulls in boto3, Pillow, requests, and numpy; no models or credentials needed here.

    Gotchas

    • The path is checked verbatim against the local filesystem. In an InstaSD deployment, make sure you're using a path the worker machine actually has - a path that exists on your laptop won't exist on the cloud runner.
    • Empty file_name is fine (you can point at a directory-less absolute path in file_path), but an empty file_path is an error by design - fill it in or the node throws.
    • It checks files and only files; a directory at that path returns False. Slightly surprising, but it's the behavior the code has, so don't treat folders as "existing".
    CategoryInstaSD/Logic

    Inputs (3)

    NameTypeDefaultDescription
    file_pathSTRING
    file_nameSTRING
    file_extensionSTRING

    Outputs (1)

    NameTypeDescription
    booleanBOOLEAN