Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between bucket() and get_bucket() on google storage

I want to download the blobs on a google storage bucket. What is the difference between the get_bucket and the bucket methods a client has? Why do they differ in permissions? Can both be used to download blobs?

like image 781
Ramon Avatar asked Oct 24 '25 04:10

Ramon


1 Answers

If you have a look to the code, you can see that

  • bucket() is simply a declaration, without any request to Cloud Storage to check if the bucket exist or not (you find the same logic with blob() method)
  • get_bucket() performs a call to Cloud Storage API to get the bucket with it's metadata (it's the same logic with get_blob())

In summary, with get_xxx you check the existence of the object, with the other method, you simply declare a name without checks.

With both, you can download the content of a Blob.

like image 193
guillaume blaquiere Avatar answered Oct 25 '25 16:10

guillaume blaquiere



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!