Prefer to listen rather than read? Check out this post on the podcast!When it comes to the cloud, there’s more than one way to serve a file. In this post, we’ll walk you through all the ways to serve data from Cloud Storage—so you can determine the best fit for your needs!You can use Cloud Storage to serve assets to your customers, and depending on your application, there are a variety of methods you might use to get that data out of a Cloud Storage bucket. In this post, we’ll cover four ways to serve those assets, but feel free to read more in the documentation, or for general, conceptual information on uploads and downloads, read this. Here we go!Client LibrariesFirst, we’ve got Client Libraries. If you need to download assets directly into your existing application, this is something for you to explore!And trust me when I say…we speak your language. With code samples in C++, C#, Go, Java, Node.js, PHP, Python, and Ruby—we’ve got you covered. Check out the documentation for more. Here’s an example of downloading from your Cloud Storage bucket using Python:gsutilUp next, you have the gsutil application. gsutil is a Python application that lets you access Cloud Storage from the command line. For our purposes, the cp command allows you to upload files from your local machine to google cloud. For example, running this command will download from a Cloud Storage bucket to a local path on your device.Additionally, gsutil comes with a plethora of options to configure to your specific use case; like the -m command, which allows for copy options to occur in parallel.REST APIsYou can also directly go to the REST APIS, using other programs like cURL to fetch your files directly and allowing the user to log in with OAuth. More on that here.Cloud ConsoleFinally, you can always access your objects right from the Cloud Console. Simply select the desired bucket, or object, and click “Download” in the handy “more actions” drop down menu. This is a great way to grab individual files when you’re debugging or going through things manually.Note: For some object types, selecting “Download” opens the object in the browser. To download these objects to your local computer, right-click on “Download” and select “Save Link As.”What’s Next?Retrieving files is really just the start, and you’ll want to make sure you’ve got a handle on controlling access – You know we’ve got another post for that, so stay tuned!Learn more about your storage options in Cloud Storage Bytes, or check out the documentationfor more information, including tutorials.Related Article5-ish ways to get your data into Cloud StorageSo you’ve created your buckets, and now you want to use the power of the cloud to serve your content. With a can-do attitude and the deta…Read Article
Quelle: Google Cloud Platform
Published by