Back
write-bytes (clj)
(source)function
(write-bytes path bytes)
(write-bytes path bytes {:keys [append create truncate-existing write], :as opts})
Writes `bytes` to `path` via `java.nio.file.Files/write`.
Supported options:
* `:create` (default `true`)
* `:truncate-existing` (default `true`)
* `:write` (default `true`)
* `:append` (default `false`)
* or any `java.nio.file.StandardOption`.
Examples:
``` clojure
(fs/write-bytes f (.getBytes (String. "foo"))) ;; overwrites + truncates or creates new file
(fs/write-bytes f (.getBytes (String. "foo")) {:append true})
```