Skip to content

Instantly share code, notes, and snippets.

View AhrazA's full-sized avatar

Ahraz AhrazA

  • Gothenburg, Sweden
View GitHub Profile
@AhrazA
AhrazA / zip-file-entries.clj
Created January 23, 2024 20:38
Lazy zip file reading in clojure
(require '(clojure.java [io :as io]))
(defn zip-file-entries [filepath]
(let [is (io/input-stream filepath)
zin (java.util.zip.ZipInputStream. is)]
((fn proc-entry [zin]
(if-let [entry (.getNextEntry zin)]
(if (not (.isDirectory entry))
(do
(let [in (java.io.BufferedInputStream. zin)