Nodes/ComfyDL/Download
ComfyUI Node

Download

ComfyDL's Download node

By Cynthia-lxx·Created 2 months ago·Updated about 16 hours ago· 6
Download
    • file_path
    urlhttps://d2l-data.s3-accelerate.amazonaws.com/hotdog.zip
    save_dir../data
    sha1_hash

    ComfyDL's dataset nodes mostly download for you, but sometimes you just need a file fetched to a folder - and you want it fetched once, not every time you hit Run. That's what CdlDownload is: a plain, cache-aware file downloader that gives you back the local path as a string you can wire into the rest of a workflow. If you've ever watched a download node re-fetch the same 200 MB archive on every queue, you'll appreciate why the caching here is the feature, not the download.

    It's the low-level utility under the hood of the pack's fancier dataset loaders, exposed on its own so you can grab arbitrary files - hotdog images, a CSV, a pretrained blob - into a known location.

    How it works

    The node calls the d2l download() helper. Give it a URL and it streams the file into save_dir, keeping the original filename. Two behaviors make it smarter than a naive fetch:

    • SHA1 cache check. If you supply sha1_hash, the node checks whether a file with that name already exists and whether its checksum matches. Match means it returns the existing path instantly - no network call.
    • Cache-friendly re-run behavior. The node declares IS_CHANGED based on the URL + hash, so ComfyUI only re-executes it when those change. In the middle of a long workflow run you won't be re-downloading anything.

    One subtlety from the source: the url field also accepts a bare d2l dataset key (like banana-detection) rather than a full https:// URL - the downloader looks it up in its registry. Handy, but honestly you'll usually want the full-URL form here and the dropdown convenience of Download + Extract for registry datasets.

    Inputs and outputs that matter

    • url (defaults to the d2l hotdog.zip link) - the file to fetch. This is the one you'll set.
    • save_dir (default ../data) - destination folder, relative to where ComfyUI was launched. Worth changing if you want downloads inside your ComfyUI folder.
    • sha1_hash (optional) - expected SHA1 of the file. Fill it in when you know it and want skip-if-cached semantics; leave empty for a plain download.

    The file_path output is a STRING with the local path. Wire it into any string input - a text display, or downstream data nodes that consume a path.

    Installing ComfyDL

    cd ComfyUI/custom_nodes
    git clone https://github.com/Cynthia-lxx/ComfyDL ./ComfyDL
    pip install -r ./ComfyDL/requirements.txt
    

    Restart ComfyUI, then look under Datasets. Dependencies are light (matplotlib, IPython, matplotlib-inline) plus requests, which ComfyUI already ships. If ComfyUI Manager doesn't list "ComfyDL" yet (young pack), the clone command is the reliable install.

    Gotchas

    Where files land is the perennial surprise: ../data is relative to the working directory ComfyUI was launched from, so in the default cd ComfyUI && python main.py setup, downloads go to a data folder sibling to ComfyUI, not inside it. If you set save_dir to an absolute path, that confusion evaporates. And note the cache only fully protects you when you provide the SHA1 - without it, the node re-downloads if the local file is missing, but it won't verify a corrupt partial file, which is the classic way a "worked yesterday" workflow starts 500ing. Supplying the hash is worth the two minutes.

    CategoryComfyDL/Datasets

    Inputs (3)

    NameTypeDefaultDescription
    urlSTRINGhttps://d2l-data.s3-accelerate.amazonaws.com/hotdog.zip
    save_diroptSTRING../data
    sha1_hashoptSTRING

    Outputs (1)

    NameTypeDescription
    file_pathSTRING