2

I'm using gcloud-node to store files on Google Cloud Storage. I would like to update metadata, like the timestamp ala touch. Is that possible?

JJ Geewax
  • 10,342
  • 1
  • 37
  • 49
jonathanberi
  • 1,867
  • 1
  • 14
  • 24

1 Answers1

4

You can pass the metadata to bucket.write as in:

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

If you want to update the metadata for an existing file, just pass the metadata inside data:

data = {
  metadata: {
    // ...
  }
};
bucket.write('HelloMessageFile', data, function(err, fileObject) {});
Silvano
  • 1,005
  • 6
  • 6