Download and Unzip gz file.

Skip to first unread message

Artem Sierikov

May 2, 2021, 10:38:45 PMMay 2
to bazel-discuss
Hi! I'm new to bazel. I need to unzip file file.gz  to two files:
  • one.txt
  • two.mmdb
So I can pass them to the binary rule as resource files. 

I can download it with the HTTP rule but how can I unzip it and reuse its content later?

Daniel Halperin

May 3, 2021, 12:55:46 AMMay 3
to Artem Sierikov, bazel-discuss
You probably want to use http_archive with build_file_content.

In the example, you could refer to @openjdk15_darwin_archive//:runtime . If you ditched the java_runtime bit and instead did

exports_files(["one.txt", "two.mmdb"], visibility = ["//visibility:public"])

it you could refer to @openjdk15_darwin_archive//:one.txt.


You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Artem Sierikov

May 5, 2021, 2:59:42 PMMay 5
to bazel-discuss
Thanks for the solution! Turns out I need to download and extract the single file with a .gz extension. And use its content. For example, I download some_file.db.gz, and then I need to be able to reference some_file.db

Can I simply do something like this?

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")

  name = "my_gz_file",
  sha256 = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",

And then reference its content 


If not how can I do it properly?

Reply all
Reply to author
0 new messages