2016-07-18 16:29:51 +00:00
|
|
|
(ns status-im.utils.fs
|
|
|
|
(:require [clojure.string :as s]
|
|
|
|
[status-im.utils.utils :as u]))
|
|
|
|
|
|
|
|
(def fs (u/require "react-native-fs"))
|
|
|
|
|
|
|
|
(defn move-file [src dst handler]
|
|
|
|
(let [result (.moveFile fs src dst)
|
|
|
|
result (.then result #(handler nil %))
|
|
|
|
result (.catch result #(handler % nil))]
|
2016-08-01 10:29:10 +00:00
|
|
|
result))
|
|
|
|
|
|
|
|
(defn read-file [path encoding on-read on-error]
|
|
|
|
(-> (.readFile fs path encoding)
|
|
|
|
(.then on-read)
|
|
|
|
(.catch on-error)))
|