Nodes/MKRShift_Nodes/Watch Folder Write
ComfyUI Node

Watch Folder Write

Drop a JSON payload into the watched folder

By criskb·Created 7 months ago·Updated 5 months ago· 0
Watch Folder Write
    • written_path
    • written_payload_json
    • summary_json
    watch_folder_plan_json{}
    payload_json{}
    filename_hint

    MKRWatchFolderWrite is the execution half of this pack's watch-folder handoff. Feed it a plan from MKRWatchFolderPlan and a payload, and it writes the payload as a JSON file into the watched folder - the moment the other side notices the new file and picks it up. If the plan node is the contract, this is the act.

    This is the graph-native way to hand a job to something that isn't ComfyUI. You don't need sockets, ports, or a shared API: you just drop a file where the other process is already looking. A render farm watches a folder for job JSON; a DCC tool watches for "please export this" packets; a second machine picks up manifests from a shared drive. The wiring on the ComfyUI side is this node, and the receiving side just needs to notice files appearing.

    Mechanically it's short and predictable: write_watch_payload ensures the watch_path from the plan exists (it creates it if missing), then writes the payload. The filename comes from filename_hint if you provide one; otherwise it's derived from the payload's job_id or name (slugified), with the extension taken from the plan's pattern - so a plan with *.json produces .json files. The file is always JSON text regardless of extension.

    The inputs that matter

    • watch_folder_plan_json - the plan from MKRWatchFolderPlan. It carries watch_path and pattern.
    • payload_json - what to write. If empty, the plan's own payload is used.
    • filename_hint - optional explicit filename. Handy when the consumer expects a fixed name.

    Outputs: written_path (the full path of the file it wrote), written_payload_json (the payload as JSON text, for verification), and summary_json (path, pattern, warnings).

    Install

    Part of MKRShift Nodes - install the pack:

    cd ComfyUI/custom_nodes
    git clone https://github.com/criskb/MKRShift_Nodes
    

    or ComfyUI Manager → search MKRShift_Nodes → restart. No pip dependencies, no ffmpeg - pure filesystem write.

    Where people get burned

    The pattern-driven naming is the sneaky bit: the extension comes from the plan's pattern, so a plan with *.png produces a .png file that still contains JSON text - the node even warns you about it in summary_json. If your consumer validates by extension, keep the plan's pattern on .json. Second, permissions: if the folder lives on a network share or somewhere ComfyUI's user can't write, the write fails with a warning and written_path still gets returned - check summary_json, not just the path. And remember the other side has to actually be watching; this node writes, it doesn't poll.

    CategoryMKRShift Nodes/Addons/Network

    Inputs (3)

    NameTypeDefaultDescription
    watch_folder_plan_jsonSTRING{}
    payload_jsonoptSTRING{}
    filename_hintoptSTRING

    Outputs (3)

    NameTypeDescription
    written_pathSTRING
    written_payload_jsonSTRING
    summary_jsonSTRING