-
Notifications
You must be signed in to change notification settings - Fork 42
/
file_watcher.clj
52 lines (42 loc) · 1.2 KB
/
file_watcher.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
(ns dustin.y2022.file-watcher
(:require [clojure.java.io :as io]
[clojure.java.data :as j]
[clojure.datafy :refer [datafy]]
[leo.file-watcher :refer [watch-dir
read-edn-forms
watch-file
path]]
[hyperfiddle.rcf :as rcf :refer [tests % tap]]
[missionary.core :as m]))
(def !x (atom nil))
(comment
(slurp (io/file "deps.edn"))
(slurp (io/file "scratch/dustin/y2022/file_watcher.clj"))
; Path
; getParent, getNameCount, getFileName, getName, subpath,
(def x @!x)
(bean x)
(datafy x)
(j/from-java x)
(str x)
(-> (path "./")
(.toAbsolutePath)
(str))
(def cancel
((m/reactor
(m/stream!
(m/ap
(let [x (m/?< (watch-dir (path "./")))]
#_(reset! !x x)
(println (str x)))))
(m/stream! (m/ap (println (m/?< (watch-file (io/file "bro.edn")))))))
prn prn))
(cancel)
(def it ((watch-file (io/file "scratch/dustin/y2022/file_watcher.clj"))
#(prn :ready) #(prn :done)))
@it
(it)
(def it (#(prn :ready) #(prn :done)))
@it
(it)
)