【问题标题】:Gzip option for gcloud-node createWriteStream uncleargcloud-node createWriteStream 的 Gzip 选项不清楚
【发布时间】:2016-09-15 22:59:28
【问题描述】:

谷歌云存储 NodeJS 库 v0.33 https://googlecloudplatform.github.io/gcloud-node/#/docs/v0.33.0/storage/file?method=createWriteStream

谁能澄清createWriteStreamgzip 选项到底有什么作用?文档对我来说有点不清楚。描述指出:

Automatically gzip the file. This will set options.metadata.contentEncoding to gzip.

它似乎可以做以下两件事之一:

  1. 实际上是gzip文件(需要用户手动解压文件)
  2. 自动压缩 http 响应,但传输完成后文件未压缩。 (即 HTTP 压缩)

由于设置了 contentEncoding,我假设情况实际上是#1。如果设置了 transferEncoding,那么我猜#2。 (参考:Transfer-Encoding: gzip vs. Content-Encoding: gzip)。但是,我担心 contentEncoding 实际上被用作传输层细节。

【问题讨论】:

    标签: gcloud-node


    【解决方案1】:

    gcloud-node 将 gzip 文件 (https://github.com/GoogleCloudPlatform/gcloud-node/blob/v0.34.0/lib/storage/file.js#L846) 并将 contentEncoding 存储为 gzip 按照说明:

    如果您使用 gzip 压缩存储对象并将其 contentEncoding 属性设置为 gzip,则通常可以以 gzip 格式提供对象。

    【讨论】:

      猜你喜欢
      • 2016-03-22
      • 2017-02-09
      • 2022-06-30
      • 2021-03-26
      • 2018-02-24
      • 2021-05-11
      • 1970-01-01
      • 2013-02-28
      • 2020-01-29
      相关资源
      最近更新 更多