use azure_storage::core::prelude::*; use azure_storage_blobs::prelude::*; use futures::stream::StreamExt; // This example shows how to stream data from a blob. We will create a simple blob first, the we // ask it back using streaming features of the future crate. In this simple example we just // concatenate the data received in order to make sure the retrieved blob is equals to the one // created in the first place. // We do not use leases here but you definitely want to do so otherwise the returned stream // is not guaranteed to be consistent. #[tokio::main] async fn main() -> azure_core::Result<()> { let file_name = "azure_sdk_for_rust_stream_test.txt"; // First we retrieve the account name and access key from environment variables. let account = std::env::var("STORAGE_ACCOUNT").expect("Set env variable STORAGE_ACCOUNT first!"); let access_key = std::env::var("STORAGE_ACCESS_KEY").expect("Set env variable STORAGE_ACCESS_KEY first!"); let container_name = std::env::args() .nth(1) .expect("please specify container name as first command line parameter"); let blob_client = StorageClient::new_access_key(&account, &access_key) .container_client(&container_name) .blob_client(file_name); let mut stream = blob_client.get().into_stream(); while let Some(res) = stream.next().await { println!("{:?}", res.unwrap()); } Ok(()) }