Nodes/Comfy-Pack/File Output
ComfyUI Node

File Output

Hand the API a file that isn't an image or video

By bentoml·Created 2 years ago·Updated 9 months ago· 218
File Output
      filename
      filename_prefixcpack_output_

      Comfy-Pack's output family covers the obvious final products - images, video, audio, text. File Output exists for everything that isn't one of those. It takes a file path and copies that file into your ComfyUI output directory under a new name, which marks it as something the pack can return when the workflow is served as an API.

      Here's the context you need: Comfy-Pack is BentoML's toolkit for turning ComfyUI workflows into reproducible artifacts and REST APIs. The output nodes are the counterpart to the input nodes - they define what the served POST /generate endpoint returns. Image Output and Video Output cover the tensors; File Output covers "whatever file this graph produced at this path."

      How it works

      The mechanism is refreshingly simple: it takes a filename (a string path, marked as force-input so it's meant to be wired from another node) and a filename_prefix, then copies the file into your output directory with the prefix prepended. Under the hood that's shutil.copy2 - no re-encoding, no re-muxing, no touching the bytes. That matters, because it means the node works on files that ComfyUI itself doesn't understand: a caption file some other tool wrote, an MP3 produced outside the graph, a ZIP from a processing node. If a node in your workflow produces a path to a real file on disk, File Output can surface it.

      The inputs

      • filename - the path of the file to copy. Default empty; you'll almost always wire this from another node's output.
      • filename_prefix - default cpack_output_. The copied file lands in your output folder as cpack_output_<basename>.

      No outputs. It's an output node in the ComfyUI sense: it terminates the graph and reports what it saved.

      Install

      Standard pack install:

      • ComfyUI Manager: search comfy-pack, Install, restart, refresh.
      • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/bentoml/comfy-pack, restart.

      BentoML and comfy-cli come along for the ride, so the first install is heavier than most.

      The honest take

      File Output is one of those nodes that reads as pointless until you need it, then you're glad it exists. The most common misunderstanding is treating it like a text writer - it's not; if you want to write text, that's Output Text to File. File Output copies an existing file. And don't confuse it with File Input, which goes the other direction (the client hands you a path). Keep the arrow straight: Input means "comes from the API caller," Output means "goes back to them." If a served workflow is meant to return a file your graph generated, File Output is the last node on that branch.

      CategoryComfyPack/output

      Inputs (2)

      NameTypeDefaultDescription
      filenameSTRING
      filename_prefixSTRINGcpack_output_

      Outputs (0)

      No outputs