MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / addFileOwner

Function addFileOwner

storage/addFileOwnerAcl.js:49–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47 const storage = new Storage();
48
49 async function addFileOwner() {
50 try {
51 await storage
52 .bucket(bucketName)
53 .file(fileName)
54 .acl.owners.addUser(userEmail);
55
56 console.log(`Added user ${userEmail} as an owner on file ${fileName}.`);
57 } catch (error) {
58 console.error(
59 'Error executing add file owner ACL:',
60 error.message || error
61 );
62 }
63 }
64
65 addFileOwner();
66 // [END storage_add_file_owner]

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected