This page shows you how to download objects from your buckets in Cloud Storage. For an overview of objects, read the Key Terms.
Console
- Open the Cloud Storage browser in the Google Cloud Console.
Open the Cloud Storage browser In the list of buckets, click on the name of the bucket that contains the object you want to download, and navigate to the object.
Click the drop-down menu associated with the object.
The drop-down menu appears as three vertical dots to the far right.
Select Download.
gsutil
Use the gsutil cp
command:
gsutil cp gs://[BUCKET_NAME]/[OBJECT_NAME] [SAVE_TO_LOCATION]
Where:
[BUCKET_NAME]
is the name of the bucket containing the object you are downloading. For example,my-bucket
.[OBJECT_NAME]
is the name of object you are downloading. For example,pets/dog.png
.[SAVE_TO_LOCATION]
is the local path where you are saving your object. For example,Desktop/Images
.
If successful, the response looks like the following example:
Operation completed over 1 objects/58.8 KiB.
Code samples
For more information, see the
Cloud Storage C++ API reference documentation
.
For more information, see the
Cloud Storage C# API reference documentation
.
For more information, see the
Cloud Storage Go API reference documentation
.
For more information, see the
Cloud Storage Java API reference documentation
.
For more information, see the
Cloud Storage Node.js API reference documentation
.
For more information, see the
Cloud Storage PHP API reference documentation
.
For more information, see the
Cloud Storage Python API reference documentation
.
For more information, see the
Cloud Storage Ruby API reference documentation
.
C++
C#
Go
Java
Node.js
PHP
Python
Ruby
REST APIs
JSON API
- Get an authorization access token from the OAuth 2.0 Playground. Configure the playground to use your own OAuth credentials.
Use
cURL
to call the JSON API with aGET
Object request:curl -X GET \ -H "Authorization: Bearer [OAUTH2_TOKEN]" \ -o "[SAVE_TO_LOCATION]" \ "https://storage.googleapis.com/storage/v1/b/[BUCKET_NAME]/o/[OBJECT_NAME]?alt=media"
Where:
[OAUTH2_TOKEN]
is the access token you generated in Step 1.[SAVE_TO_LOCATION]
is the path to the location where you want to save your object. For example,Desktop/dog.png
.[BUCKET_NAME]
is the name of the bucket containing the object you are downloading. For example,my-bucket
.[OBJECT_NAME]
is the name of object you are downloading. For example,pets/dog.png
. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.
XML API
- Get an authorization access token from the OAuth 2.0 Playground. Configure the playground to use your own OAuth credentials.
Use
cURL
to call the XML API with aGET
Object request:curl -X GET \ -H "Authorization: Bearer [OAUTH2_TOKEN]" \ -o "[SAVE_TO_LOCATION]" \ "https://storage.googleapis.com/[BUCKET_NAME]/[OBJECT_NAME]"
Where:
[OAUTH2_TOKEN]
is the access token you generated in Step 1.[SAVE_TO_LOCATION]
is the path to the location where you want to save your object. For example,Desktop/dog.png
.[BUCKET_NAME]
is the name of the bucket containing the object you are downloading. For example,my-bucket
.[OBJECT_NAME]
is the name of object you are downloading. For example,pets/dog.png
.
To easily download all objects in a bucket or subdirectory, use the
gsutil cp
command.