Posts

Showing posts with the label Write Stream

Google Storage set file permission when Save File or Write Stream

Image
The brackets in the Google cloud storage or Firebase storage have a permission set which is common to all files. However, we should have the capability to set the permission to each file as we need. Although I have discussed early in the post  Make Storage Public , the custom permission can correctly assign using  ALC. Refer the Doc:https://cloud.google.com/nodejs/docs/reference/storage/1.3.x/Acl#add If you are using a storage file you can access the file and do the modification.    const file = firebase.storage().bucket().file('originals/file.png');                                    const options = {                                     entity: 'allUsers',                                     role: storage.acl.READER_ROLE                                   };                             file.acl.add(options, function(err, aclObject) {}); If you are using a write stream, the process is a bit different. You have to create metadata variable a