Skip to content

Commit

Permalink
chore: resolve reflection in download-file-from-storage
Browse files Browse the repository at this point in the history
  • Loading branch information
edporras committed Jul 1, 2024
1 parent 0ee402d commit 4a30fee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/clj_gcloud/storage.clj
Original file line number Diff line number Diff line change
Expand Up @@ -243,5 +243,10 @@
Usage :
(download-file-from-storage storage-client 'gs://mybucket/myfolder/.../myfile' 'mylocalfile')"
[^Storage storage source-gs-uri dest-local-path & _options]
(let [blob (->> source-gs-uri ->blob-id (get-blob storage))]
(.downloadTo blob (Paths/get dest-local-path (make-array String 0)) (into-array Blob$BlobSourceOption []))))
(let [^Blob blob (->> source-gs-uri ->blob-id (get-blob storage))
path (Paths/get dest-local-path (make-array String 0))
;; this resolves reflection but it's pretty ugly:
;; ^"[Lcom.google.cloud.storage.Blob$BlobSourceOption;" opts (into-array Blob$BlobSourceOption [])
;; for now skip it, since we pass no options anyway
]
(.downloadTo blob path)))
1 change: 0 additions & 1 deletion test/clj_gcloud/storage_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@
(is (delete-blob *storage* (.getBlobId blob)))
(is (= 0 (count (ls *storage* dest-uri)))))
(.delete tmp))))

0 comments on commit 4a30fee

Please sign in to comment.