This page discusses concepts related to reading and downloading objects in Cloud Storage.
Object reads
Reading an object refers to streaming, consuming, or inspecting object data or a specific byte range over an open network connection directly in memory. Rather than saving the retrieved payload locally, your application buffers the ephemeral data in a memory stream, buffer, or pipeline, or directly in CPU or GPU memory. Reading objects is suitable for high-performance, throughput-intensive workloads, such as streaming training datasets and tensor batches into artificial intelligence (AI) and machine learning (ML) frameworks such as PyTorch or JAX.
The following list describes the types of object reads available in Cloud Storage:
Reading objects into memory or interactive object reads: methods where your application loads data into memory or you view the data interactively without saving a file to disk. When you read an object into memory, your client retrieves the object (or a specified byte range) and loads the bytes into a contiguous variable, byte array, or in-memory string. When you read an object interactively, you view the data in your browser or direct its byte stream to standard output (
stdout) in your terminal.Streaming reads: a method where your application consumes data as a stream of bytes directly as it receives the bytes from the network, rather than waiting for the entire transfer to finish.
Object downloads
Downloading an object is an end-to-end task that transfers object data from Cloud Storage into a persistent file on a local file system, disk, or target storage device. Unlike in-memory streaming reads, downloading encompasses both fetching the remote bytes and committing them to local storage. Downloading objects is primarily suited for general-purpose file management, local archiving, data backup, and offline utility usage.
When you use the REST APIs, your client performs downloads by sending HTTP or
HTTPS GET requests. These requests can include an optional Range header,
which defines a specific portion of the object to download to persistent or
local storage. Your client can also use the Range header to resume interrupted
downloads. When you use gRPC, your client performs downloads using
google.storage.v2.Storage/ReadObject or
google.storage.v2.Storage/BidiReadObject streams.
The following list describes the types of object downloads available in Cloud Storage:
Simple downloads: a basic form of object download where your client sends a single request to retrieve either the entire object or a specified byte range in one continuous transfer.
Sliced object downloads: a high-performance strategy where a single large object is divided into multiple smaller slices (also known as chunks). The client downloads these slices in parallel using multiple independent and concurrent requests, and then reassembles the slices locally into a single file.
Tool support for reading and downloading objects
The following tabs list the object read and download methods that you can perform with each tool, client library, and API:
Console
When using the Google Cloud console, you can perform the following object reads and downloads:
Command line
You can perform the following object reads and downloads when using the Google Cloud CLI:
Client libraries
C++
You can perform the following types of reads and downloads when using the C++ client library:
C#
You can perform the following types of reads and downloads when using the C# client library:
Go
You can perform the following types of reads and downloads when using the Go client library:
Java
You can perform the following types of reads and downloads when using the Java client library:
Node.js
You can perform the following types of reads and downloads when using the Node.js client library:
PHP
You can perform the following types of reads and downloads when using the PHP client library:
Python
You can perform the following types of reads and downloads when using the Python client library:
Ruby
You can perform the following types of reads and downloads when using the Ruby client library:
Rust
You can perform the following types of reads and downloads when using the Rust client library:
REST APIs
If you use REST APIs to read or download objects, see Request endpoints for more information about the request endpoints that you can use.
JSON API
You can perform the following types of reads and downloads when using the JSON API:
XML API
You can perform the following types of reads and downloads when using the XML API:
What's next
- Make your data publicly accessible.
- Learn how Cloud Storage uses checksums to validate object reads and downloads.
- Learn about object uploads.
- View and edit your object metadata.
- Learn how to transfer data to Cloud Storage using Storage Transfer Service.
- Transfer objects from your Compute Engine instance.