Skip to content

Instantly share code, notes, and snippets.

@metametadata
Created February 22, 2018 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metametadata/9c739abf6616ecabef8546c67b7d2905 to your computer and use it in GitHub Desktop.
Save metametadata/9c739abf6616ecabef8546c67b7d2905 to your computer and use it in GitHub Desktop.
with-temp-file in Lumo
(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