Skip to content

Instantly share code, notes, and snippets.

@jcromartie
Created January 26, 2010 14:56
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 jcromartie/286894 to your computer and use it in GitHub Desktop.
Save jcromartie/286894 to your computer and use it in GitHub Desktop.
(ns atomic-spit
(:use clojure.contrib.duck-streams))
(defn atomic-spit [path data]
(let [temp (File/createTempFile "spit" nil)]
(spit temp data)
(.renameTo temp (File. path))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment