【问题标题】:Override content type when uploading files to GCS with gsutil使用 gsutil 将文件上传到 GCS 时覆盖内容类型
【发布时间】:2018-12-18 20:51:05
【问题描述】:

我有大量文件需要上传到 Google Cloud Storage 并向它们添加内容类型。所有文件名都没有扩展名,但所有文件的内容类型都相同。

我尝试使用此命令gsutil -m cp -r . gs://bucket_name/,但它会上传具有application/octet-stream 内容类型的文件。

有没有办法覆盖 GCS 设置的默认内容类型?

【问题讨论】:

    标签: google-cloud-platform google-cloud-storage gsutil


    【解决方案1】:

    Here,它给出了一个如何做到这一点的例子:

    gsutil -h "Content-Type:text/html" \
           -h "Cache-Control:public, max-age=3600" cp -r images \
           gs://bucket/images
    

    【讨论】:

      猜你喜欢
      • 2014-09-05
      • 2020-12-10
      • 2018-06-14
      • 2019-10-26
      • 2011-08-27
      • 2021-10-09
      • 2021-10-05
      • 2023-03-17
      • 2019-09-11
      相关资源
      最近更新 更多