Liking cljdoc? Tell your friends :D

Duct file.temp Build Status

Integrant methods for creating temporary files and directories when the system is initiated, and deleting them when the system is halted.

Installation

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"]

Usage

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"}}

License

Copyright © 2026 James Reeves

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close