【问题标题】:Can you update metadata with gcloud-node您可以使用 gcloud-node 更新元数据吗
【发布时间】:2014-08-26 16:52:34
【问题描述】:

我正在使用 gcloud-node 将文件存储在 Google Cloud Storage 上。我想更新元数据,例如时间戳 ala touch。这可能吗?

【问题讨论】:

    标签: node.js google-cloud-storage gcloud-node


    【解决方案1】:

    您可以将元数据传递给bucket.write,如下所示:

    data = {
      data: 'Hello World',
      metadata: {
        // ...
      }
    };
    bucket.write('HelloMessageFile', data, function(err, fileObject) {});
    

    如果您想更新现有文件的元数据,只需将元数据传递到data

    data = {
      metadata: {
        // ...
      }
    };
    bucket.write('HelloMessageFile', data, function(err, fileObject) {});
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-26
      • 2021-10-27
      • 2014-08-29
      相关资源
      最近更新 更多