Last active
December 27, 2016 05:51
-
-
Save olslash/4804c246b02e5a9e7237aed3ec41ed07 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 gunzip | |
"Writes the contents of input to output, decompressed. | |
input: something which can be opened by io/input-stream. | |
The bytes supplied by the resulting stream must be gzip compressed. | |
output: something which can be copied to by io/copy." | |
[input output & opts] | |
(with-open [input (-> input io/input-stream GZIPInputStream.)] | |
(apply io/copy input output opts))) | |
;; ... snip ... | |
(defn -main [] | |
(let [sources (map #(vector (clojure.string/replace (.getName %) #".xml$" "") | |
(get-first-source-url %)) | |
sources)] ;; a list of vectors: [filename url] | |
(doall (pmap #(-> (second %) | |
io/input-stream | |
(gunzip (io/file (format "./docsets/%s.docset" (first %))))) | |
(take 1 sources))))) ;; just try one for testing | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment