Google Cloud Storage ACL with expiry time

228
March 26, 2018, at 00:33 AM

I'm building an application using Google Cloud Storage where users will be able to share their files with other users for a period of time that they choose. After that, the permission to view the file will be revoked.

One way would be to generate signed urls and share those. However, I'd like to use ACL instead since it's much cleaner to use I think. When a user shares a file I can simply add the new user to the ACL with an expiry time. So basically, the following code with some kind of a time attribute to automatically remove user1 from the acl after, say, t seconds.

storage
  .bucket(bucketName)
  .file(filename)
  .acl.readers.addUser(user1)
  .then(() => {
    console.log(`Added user ${user1} as an owner on file ${filename}.`);
  })
  .catch(err => {
    console.error('ERROR:', err);
  });

Is this possible?

READ ALSO
run a few node.js web servers from within a node.js application

run a few node.js web servers from within a node.js application

I would like to control a few web sites using a UI to start and stop them, changing the ports that the different web server's listen to

153
Using axios with async and await

Using axios with async and await

I am new in Async and await ecosystem, but I know that it gives the way of coding in a synchronous way (although it is async behind the scenes, just the way it is written in code)

2433
undefined is not a function when calling asyc await

undefined is not a function when calling asyc await

Please see my code, i am not being able to find what's wrong in the code

178
I can't create angular project

I can't create angular project

i am facing a problem with angular 5I downloaded angular 5 using command "npm install --save-dev @angular/cli@latest"

172