Integrant methods for creating temporary files and directories when the system is initiated, and deleting them when the system is halted.
Add the following dependency to your deps.edn file:
org.duct-framework/file.temp {:mvn/version "0.1.0"}
Or to your Leiningen project file:
[org.duct-framework/file.temp "0.1.0"]
To create a temporary file that will last until the system is halted:
{:duct.file.temp/file {:prefix "example", :suffix ".txt"}}When initiated, this key will be assigned a java.io.File instance
that points to the temporary file. You may optionally supply a :prefix
and :suffix to make the temporary file easier to identify.
Similarly, to create a temporary directory:
{:duct.file.temp/dir {:prefix "example"}}This takes an optional :prefix key, but no suffix. When the system is
halted the directory and all of its contents will be deleted.
Because you might need multiple temporary files or directories, it's recommended that you derive a child key, or use a unique composite key:
{[:duct.file.temp/dir :example/my-temp-dir] {:prefix "example"}}Copyright © 2026 James Reeves
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.