GCS Rust SDK Download Object API
SkillFiles & storageFix "DownloadObjectRequest not found" error in google-cloud-storage Rust crate. Use when: (1) Trying to download objects from GCS using the Rust SDK, (2) Looking for a download request type in http::objects::download module, (3) Compile error about missing type. The download_object method uses GetObjectRequest from the get module, not a separate DownloadObjectRequest type.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the GCS Rust SDK Download Object API skill
What this skill tells your AI
The instructions your AI receives, as published by divinevideo/divine-mobile in .agents/skills/gcs-rust-download-object-api/SKILL.md and read by ahel’s review.
Problem
When using the google-cloud-storage Rust crate to download objects, developers often
look for a DownloadObjectRequest type in the download module, expecting it to mirror
the upload pattern. This type doesn't exist, causing confusing compile errors.
Context / Trigger Conditions
- Using
google-cloud-storagecrate in Rust - Trying to call
client.download_object() - Error:
unresolved import google_cloud_storage::http::objects::download::DownloadObjectRequest - Looking in
http::objects::downloadmodule for request types
Solution
The download_object method uses GetObjectRequest from the get module, combined with
Range from the download module:
use google_cloud_storage::http::objects::{
download::Range as DownloadRange,
get::GetObjectRequest,
};
// Download full object
let data = client.download_object(
&GetObjectRequest {
bucket: "my-bucket".to_string(),
object: "path/to/object".to_string(),
..Default::default()
},
&DownloadRange::default(),
).await?;
// Download partial object (bytes 0-1023)
let partial = client.download_object(
&GetObjectRequest {
bucket: "my-bucket".to_string(),
object: "path/to/object".to_string(),
..Default::default()
},
&DownloadRange::Bounded(0, 1023),
).await?;
Verification
Code compiles and download_object returns Vec<u8> with the object contents.
Example
use google_cloud_storage::{
client::{Client as GcsClient, ClientConfig},
http::objects::{
download::Range as DownloadRange,
get::GetObjectRequest,
upload::{Media, UploadObjectRequest, UploadType},
},
};
async fn download_from_gcs(client: &GcsClient, bucket: &str, key: &str) -> Result<Vec<u8>> {
let data = client.download_object(
&GetObjectRequest {
bucket: bucket.to_string(),
object: key.to_string(),
..Default::default()
},
&DownloadRange::default(),
).await?;
Ok(data)
}
Notes
- The
Rangetype is aliased asDownloadRangeto avoid conflicts with std::ops::Range DownloadRange::default()downloads the entire object- For checking if an object exists without downloading, use
get_objectwithGetObjectRequest - The
Media.content_typefield isCow<'static, str>, use.into()for string conversion
References
Signals
- GitHub stars
- 264
- Forks
- 55
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
gcs-rust-download-object-api- Source
- github.com/divinevideo/divine-mobile