🎉 Add binfile-v3 export/import file format

This commit is contained in:
Andrey Antukh 2024-10-15 17:56:22 +02:00
parent 4fb5d3fb20
commit 8618cb950f
35 changed files with 2031 additions and 599 deletions

View file

@ -33,16 +33,24 @@
(defn- process-file
[entry path type]
;; (js/console.log "zip:process-file" entry path type)
(cond
(nil? entry)
(p/rejected (str "File not found: " path))
(.-dir entry)
(.-dir ^js entry)
(p/resolved {:dir path})
:else
(-> (.async entry type)
(p/then #(hash-map :path path :content %)))))
(->> (.async ^js entry type)
(p/fmap (fn [content]
;; (js/console.log "zip:process-file" 2 content)
{:path path
:content content})))))
(defn load
[data]
(rx/from (zip/loadAsync data)))
(defn get-file
"Gets a single file from the zip archive"