有一些与上传图片和分享相关的问题。 我找到了相关的问题和答案,但现在确实有效。 Google云以此错误响应
NodeJS gcloud - Upload to google storage with public-read property/custom cache-expire
{ [Error: Required]
errors: [ { domain: 'global', reason: 'required', message: 'Required' } ],
code: 400,
message: 'Required',
response: undefined }
理想情况下,我想上传文件,然后通过公共域访问它。我不想要任何流媒体解决方案,就像通过api打开文件一样。
// bucket is defined, uploading is fine
var file = bucket.file(id);
stream.pipe(file.createWriteStream());
//Giving permissions
bucket.acl.default.add({
scope: "allUsers",
role: gcloud.storage.acl.READER_ROLE
}, function(err) {
console.log(err);
// i am getting an error there
})
谢谢!