chris.mclennon
chris.mclennon

Reputation: 1036

gsutil cp is unzipping my gzipped files

I have a bunch of already gzipped files in GCS that I'd like to download but keep compressed. When I try to download the files running command: gsutil -m cp -r gs://my-bucket-name/path/to/dir/, it downloads the files then immediately unzips them.

The files appear to have Content-Encoding:gzip in their metadata, and gsutil cp seems to have the default behavior that files with this encoding will automatically decompress when served.

How can I just download the files as-is without it being automatically decompressed?

Upvotes: 1

Views: 4906

Answers (1)

Mangu
Mangu

Reputation: 3325

You can use the option Cache-Control: no-transform as indicated here.

As an example:

gsutil -m -h "Cache-Control: no-transform" cp -r gs://YOUR-BUCKET/ .

Upvotes: 4

Related Questions