with-temp-dir
macro
babashka.fs/with-temp-dir
(with-temp-dir [[[binding-name] & body] [[binding-name options] & body]])Evaluates body with binding-name bound to the result of `(create-temp-dir
options)`. See [[create-temp-dir]] for valid `options`.
The directory will be removed with [[delete-tree]] on exit from the scope,
unless the option `:keep true` is used.
Example:
```
(with-temp-dir [d]
(let [t (path d "extract")
(create-dir t)
(gunzip path-to-zip t)
(copy (path t "the-one-file-I-wanted.txt") (path permanent-dir "file-I-extracted.txt"))))
;; d no longer exists here
```
Examples
No examples yet. Be the first to add one!