Override content type when uploading files to GCS with gsutil
Asked Answered
C

1

6

I have a large number of files that I need to upload to Google Cloud Storage and add content type to them. All file names don't have an extension, but content type is the same for all of them.

I tried to use this command gsutil -m cp -r . gs://bucket_name/, but it uploads files with application/octet-stream content type.

Is there a way to override default content type that GCS sets?

Cornelison answered 10/7, 2018 at 22:40 Comment(0)
G
13

Here, it gives an example of how to do this:

gsutil -h "Content-Type:text/html" \
       -h "Cache-Control:public, max-age=3600" cp -r images \
       gs://bucket/images
Gambetta answered 10/7, 2018 at 22:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.