Skip to main content

write-bytes

function

babashka.fs/write-bytes

(write-bytes [path bytes] [path bytes {:keys [append create truncate-existing write], :as opts}])
Writes `bytes` to `path` via [Files/write](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#write(java.nio.file.Path,byte%5B%5D,java.nio.file.OpenOption...)). 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}) ```

No examples yet. Be the first to add one!