How to set Google Cloud Storage setting "Share publicly" false and show a checkbox in front of filename -
when upload image node.js application, image uploaded publicly since public link available. want upload image privately
const storage = storage({ projectid: config["googleprojectid"] }); (var key in cloud_bucket){ bucketreference[key] = storage.bucket(cloud_bucket[key]); } const gcsname = "your."+extension; if(bucketreference[tag]){ file = bucketreference[tag].file(gcsname); }
this uploading image baseurl/bucket_name/your.jpeg public link available , can see pasting in url , signing in gmail.
i want bring checkbox instead of public link on upload (as happens when manually upload on storage).
please out in resolving !
got answer !
const stream = file.createwritestream({ metadata: { contenttype: "image/jpeg", }, predefinedacl: "bucketownerread"//shows no checkbox since project owner has reader access , no 1 accept object owner can see images predefinedacl: "bucketownerfullcontrol" //shows checkbox , shows image project owners });
"predefinedacl" key. makes image while upload public or private.
this allows project team owners access make urls public or view urls in incognito after signing in.
Comments
Post a Comment