status-react/src/status_im/utils/fs.cljs

45 lines
886 B
Plaintext
Raw Normal View History

2017-07-16 09:04:35 +00:00
(ns status-im.utils.fs
(:require ["react-native-fs" :as react-native-fs]))
(defn move-file
[src dst]
(.moveFile react-native-fs src dst))
(defn stat
[path on-stat on-error]
(-> (.stat react-native-fs path)
(.then on-stat)
(.catch on-error)))
(defn read-file
[path encoding on-read on-error]
(-> (.readFile react-native-fs path encoding)
(.then on-read)
(.catch on-error)))
(defn write-file
[path content encoding on-write on-error]
(-> (.writeFile react-native-fs path content encoding)
(.then on-write)
(.catch on-error)))
(defn read-dir
[path]
(.readDir react-native-fs path))
(defn mkdir
[path]
(.mkdir react-native-fs path))
(defn unlink
[path]
(.unlink react-native-fs path))
(defn file-exists?
[path]
(.exists react-native-fs path))
(defn cache-dir
[]
(.-CachesDirectoryPath ^js react-native-fs))