为了我的应用程序的正确安全性,我不得不为firebase设置一个小的nodejs服务器,但问题还没有结束...... firebase服务器sdk不支持存储api。我读到这是必要的gcloud存储apis,因为firebase使用相同的服务。
服务器端的对于获取文件自定义元数据非常重要,因为我必须阅读并更新它们。我没有找到适当的函数来获取文件元数据。在客户端sdk很简单
_a
并在gcloud存储中我可以使用哪些功能?感谢
答案 0 :(得分:1)
您需要在getMetadata()中使用gcloud方法:
var gcloud = require('gcloud');
// Initialize GCS
var gcs = gcloud.storage({
projectId: 'my-project',
keyFilename: '/path/to/keyfile.json'
});
// Reference an existing bucket
var bucket = gcs.bucket('foo.appspot.com');
// Reference to a file
var file = bucket.file('path/to/my/file');
// Get the file metadata
file.getMetadata(function(err, metadata, apiResponse) {
if (err) {
console.log(err);
} else {
console.log(metadata);
}
});