2016-12-27 13:46:06 +00:00
|
|
|
(ns status-im.utils.fs)
|
2016-07-18 16:29:51 +00:00
|
|
|
|
2016-10-24 20:46:06 +00:00
|
|
|
(def fs (js/require "react-native-fs"))
|
2016-07-18 16:29:51 +00:00
|
|
|
|
|
|
|
(defn move-file [src dst handler]
|
2017-05-18 22:19:46 +00:00
|
|
|
(-> (.moveFile fs src dst)
|
|
|
|
(.then #(handler nil %))
|
|
|
|
(.catch #(handler % nil))))
|
2016-08-01 10:29:10 +00:00
|
|
|
|
|
|
|
(defn read-file [path encoding on-read on-error]
|
|
|
|
(-> (.readFile fs path encoding)
|
|
|
|
(.then on-read)
|
2016-10-24 20:46:06 +00:00
|
|
|
(.catch on-error)))
|