Get Temp Directory
Hand the temp folder path to another node
- temp_dir
This one does exactly what it says and nothing more: it outputs the path to ComfyUI's temp directory as a string. No inputs, no settings, just a single temp_dir STRING coming out the side. It exists so you don't have to hardcode a path that changes between machines, installs, and operating systems.
Why would you want it? Because ComfyUI's temp folder is the scratch space - it's where previews land, and crucially it gets wiped every time the server restarts. If you're building a workflow that writes an intermediate file and reads it back in the same run, or you want to point a loader at "wherever temp happens to be on this box," you grab the path from here instead of typing /some/absolute/path/temp and praying it's the same on the next machine. It's the kind of small connective node that makes a graph portable.
How it works
There's no mechanism to speak of. When the graph runs, the node asks ComfyUI where its temp directory is and emits that as a string. The value is resolved at runtime, so it's correct for whatever install you're on. That's the entire value proposition: a path that's right by construction instead of right by luck.
The inputs and outputs
There are no inputs. The single output is temp_dir (STRING) - the absolute path to the temp folder. You wire it into anything that takes a directory or a base path: JNodes_SelectRandomFileFromDirectory, a save node's path field, a load-from-path node, or string-building nodes that assemble a full filename. Its natural partner is JNodes_GetOutputDirectory, which does the identical trick for the output folder.
How to install it
Via ComfyUI Manager: Install Custom Nodes, search "JNodes", install, restart. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/JaredTherriault/ComfyUI-JNodes
pip install -r ComfyUI-JNodes/requirements.txt
then restart ComfyUI. No model downloads, no heavy dependencies for this particular node - it's part of the broader JNodes suite (a grab-bag of UX and utility nodes Jared Therriault has been maintaining since 2024), but the temp-directory node itself is about as lightweight as a node gets.
Common issues & troubleshooting
Remember the temp folder is volatile. This is the single thing to internalize: anything in temp is gone on the next restart. That's by design - it's scratch space, not storage. If you write something there expecting it to survive, it won't. For anything you want to keep, use JNodes_GetOutputDirectory and the output folder instead.
The string is a directory, not a file. The output is the folder path with no trailing filename. If a downstream node wants a full file path, you'll need to concatenate a filename onto it yourself with a string node.
On serverless or hosted ComfyUI, temp is per-run and ephemeral. If you're running this somewhere other than a persistent local box, don't assume files written to temp in one execution are visible in a later one - the environment may be fresh each time. That's not a bug in the node; it's the nature of temp directories in a managed environment.
Honestly, there's not much to break here. It's a helper node that removes one small source of "works on my machine" fragility, and that's the whole point.
Inputs (0)
No inputs
Outputs (1)
| Name | Type | Description |
|---|---|---|
| temp_dir | STRING | — |