Created
February 22, 2018 18:24
-
-
Save metametadata/9c739abf6616ecabef8546c67b7d2905 to your computer and use it in GitHub Desktop.
with-temp-file in Lumo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require '[lumo.io :as lumo-io]) | |
(def -fs-extra (js/require "fs-extra")) | |
(defn with-temp-file | |
"Temporarily creates a file with the specified content and calls f." | |
[path content f] | |
(lumo-io/spit path content) | |
(try | |
(f) | |
(finally | |
(.removeSync -fs-extra path)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment