This page shows you how to download objects from your buckets in Cloud Storage. For a conceptual overview, see Uploads and downloads.
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.
The Bucket details page opens, with the Objects tab selected.
Navigate to the object, which may be located in a folder.
Click the more actions menu (
) associated with the object.
Select Download.
See Troubleshooting for how to get detailed error information about failed operations in the Cloud Storage browser.
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.
What's next
- Read the conceptual overview for uploading and downloading.
- Upload objects to your bucket.
- Learn how to perform streamed downloads.
- Transfer objects to your Compute Engine instance.
- Learn how you can bill Cloud Storage access charges to requesters.
- Learn how Cloud Storage can serve gzipped files in an uncompressed state.