Google Storage support for tools.io.
; read json
(doseq [x (read-jsons-file "gs://bucket/sample.jsons.gz")]
(println x))
; list files
(doseq [filename (list-files "gs://bucket/mydir/")]
(println filename))
; -> output:
; gs://bucket/mydir/example/raw-animals-aaaaaaaaaa.jsons.gz
; gs://bucket/mydir/example/raw-animals-aaaaaaaaab.jsons.gz
; gs://bucket/mydir/example/raw-animals-aaaaaaaaac.jsons.gz
; gs://bucket/mydir/example/raw-animals-aaaaaaaaad.jsons.gz
; gs://bucket/mydir/example/raw-animals-aaaaaaaaae.jsons.gz
; list files in a (virtual) directory
(doseq [filename (list-files "gs://bucket/mydir/" {:current-directory true})]
(println filename))
; list dirs
(->> (list-dirs "gs://bucket/dir")
count)
; -> output:
; gs://bucket/mydir/example/
; Get folder/file size
(sizeof "gs:/foo/bar") ;; => 8293
; object metadata, nil when absent
(tools.io.gs/object-meta "gs://bucket/sample.jsons.gz")
; => {:generation 1792702957806998, :size 31, :crc32c "hoYO7g==",
; :created-at #inst "2026-10-22T21:02:37.810Z"}
; read one generation; fails once it is overwritten (on unversioned buckets)
(read-jsons-file "gs://bucket/sample.jsons.gz" {:generation 1792702957806998})
; write only if absent (0), or only over a given generation
(write-edn-file "gs://bucket/out.edn" {:if-generation-match 0} {:a 1})
Copyright © 2016-2025 Oscaro.com
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.
Can you improve this documentation? These fine people already did:
Ed Porras, iomonad, Baptiste Fontaine, Marc Faucon & CitrouilleEdit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |