Got some question related to uploading image and sharing it. I found related question with answer, but it does now work. Google cloud responds with this error
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 }
Ideally i want to upload a file, and then access it though public domain. I don't want to have any streaming solutions, as in like opening file through 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
})
Thanks!