create-temp-dir
function
babashka.fs/create-temp-dir
(create-temp-dir [] [{:keys [:dir :prefix :posix-file-permissions], :as opts}])Creates a directory using [Files/createTempDirectory](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#createTempDirectory(java.nio.file.Path,java.lang.String,java.nio.file.attribute.FileAttribute...)).
This function does not set up any automatic deletion of the directories it
creates. See [[with-temp-dir]] for that functionality.
Options:
* `:dir`: Directory in which to create the new directory. Defaults to default
system temp dir (e.g. `/tmp`); see [[temp-dir]]. Must already exist.
* `:prefix`: Provided as a hint to the process that generates the name of the
new directory. In most cases, this will be the beginning of the new directory
name. Defaults to a random (v4) UUID.
* `:posix-file-permissions`: The new directory will be created with these
permissions, given as a String as described in [[str->posix]]. If not
specified, uses the file system default permissions for new directories.
Affected by [umask](/README.md#umask).
* :warning: `:path` **[DEPRECATED]** Previous name for `:dir`, kept
for backwards compatibility. If both `:path` and `:dir` are given (don't do
that!), `:dir` is used.
Examples:
* `(create-temp-dir)`
* `(create-temp-dir {:posix-file-permissions "rwx------"})`
* `(create-temp-dir {:dir (path (cwd) "_workdir") :prefix "process-1-"})`
Examples
No examples yet. Be the first to add one!