2017-07-16 09:04:35 +00:00
|
|
|
(ns status-im.utils.fs
|
|
|
|
(:require [status-im.react-native.js-dependencies :as rn-dependencies]))
|
2016-07-18 16:29:51 +00:00
|
|
|
|
2018-07-11 19:52:53 +00:00
|
|
|
(defn move-file [src dst]
|
2019-05-22 05:50:49 +00:00
|
|
|
(.moveFile (rn-dependencies/fs) src dst))
|
2016-08-01 10:29:10 +00:00
|
|
|
|
|
|
|
(defn read-file [path encoding on-read on-error]
|
2019-05-22 05:50:49 +00:00
|
|
|
(-> (.readFile (rn-dependencies/fs) path encoding)
|
2016-08-01 10:29:10 +00:00
|
|
|
(.then on-read)
|
2016-10-24 20:46:06 +00:00
|
|
|
(.catch on-error)))
|
2018-06-21 18:08:10 +00:00
|
|
|
|
|
|
|
(defn read-dir [path]
|
2019-05-22 05:50:49 +00:00
|
|
|
(.readDir (rn-dependencies/fs) path))
|
2018-07-11 19:52:53 +00:00
|
|
|
|
|
|
|
(defn mkdir [path]
|
2019-05-22 05:50:49 +00:00
|
|
|
(.mkdir (rn-dependencies/fs) path))
|
2018-07-11 19:52:53 +00:00
|
|
|
|
|
|
|
(defn unlink [path]
|
2019-05-22 05:50:49 +00:00
|
|
|
(.unlink (rn-dependencies/fs) path))
|
2018-11-26 15:52:29 +00:00
|
|
|
|
|
|
|
(defn file-exists? [path]
|
2019-05-22 05:50:49 +00:00
|
|
|
(.exists (rn-dependencies/fs) path))
|