-
-
Save jraines/65e2628b699abf759da78e5d265d0d0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn process-image-file | |
[file] | |
(let [filename (.getName file)] | |
(when-let [item (find-by-image-filename-no-path filename)] | |
(let [f (ZipFile. (io/file "/tmp/what"))] | |
(io/copy (.getInputStream f file) | |
(io/file "resources" "tmp" (str (:id item) "-" filename))))))) | |
(defn- entries [zipstream] | |
(lazy-seq | |
(if-let [entry (.getNextEntry zipstream)] | |
(cons entry (entries zipstream))))) | |
(defn walkzip [file] | |
(with-open [z (ZipInputStream. (io/input-stream file))] | |
(doseq [e (entries z)] | |
(process-image-file e)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment