rusoto

Streamed upload to s3 with rusoto

白昼怎懂夜的黑 提交于 2020-02-22 08:08:26
问题 How can I upload file to s3 using rusoto, without reading file content to memory (streamed)? With this code: use std::fs::File; use std::io::BufReader; use rusoto_core::Region; use rusoto_s3::{PutObjectRequest, S3, S3Client, StreamingBody}; fn main() { let file = File::open("input.txt").unwrap(); let mut reader = BufReader::new(file); let s3_client = S3Client::new(Region::UsEast1); let result = s3_client.put_object(PutObjectRequest { bucket: String::from("example_bucket"), key: "example

Streamed upload to s3 with rusoto

孤者浪人 提交于 2020-02-22 07:59:33
问题 How can I upload file to s3 using rusoto, without reading file content to memory (streamed)? With this code: use std::fs::File; use std::io::BufReader; use rusoto_core::Region; use rusoto_s3::{PutObjectRequest, S3, S3Client, StreamingBody}; fn main() { let file = File::open("input.txt").unwrap(); let mut reader = BufReader::new(file); let s3_client = S3Client::new(Region::UsEast1); let result = s3_client.put_object(PutObjectRequest { bucket: String::from("example_bucket"), key: "example

How do I pass a struct with type parameters as a function argument?

…衆ロ難τιáo~ 提交于 2019-12-22 18:10:02
问题 How do I pass an instance of EcsClient with the signature impl<P, D> EcsClient<P, D> where P: ProvideAwsCredentials, D: DispatchSignedRequest to a function as a reference in Rust? My attempt is thus: extern crate rusoto; use std::default::Default; use rusoto::{ DefaultCredentialsProvider, Region }; use rusoto::ecs::{ EcsClient }; use rusoto::default_tls_client; fn get_task_definition_revisions(client: &EcsClient) { // Use EscClient instance here } fn main() { let provider =

How to save a file downloaded from S3 with Rusoto to my hard drive?

為{幸葍}努か 提交于 2019-12-02 02:46:41
问题 I am trying to download a file from a bucket with Rusoto and I am getting the file content: fn get_object(client: &TestClient, bucket: &str, filename: &str) { let get_req = GetObjectRequest { bucket: bucket.to_owned(), key: filename.to_owned(), ..Default::default() }; let result = client.get_object(&get_req).sync().expect("Couldn't GET object"); let stream = result.body.unwrap(); let body = stream.concat2().wait().unwrap(); assert!(body.len() > 0); } How can I save this GetObjectOutput(result

How to save a file downloaded from S3 with Rusoto to my hard drive?

你离开我真会死。 提交于 2019-12-01 22:48:56
I am trying to download a file from a bucket with Rusoto and I am getting the file content: fn get_object(client: &TestClient, bucket: &str, filename: &str) { let get_req = GetObjectRequest { bucket: bucket.to_owned(), key: filename.to_owned(), ..Default::default() }; let result = client.get_object(&get_req).sync().expect("Couldn't GET object"); let stream = result.body.unwrap(); let body = stream.concat2().wait().unwrap(); assert!(body.len() > 0); } How can I save this GetObjectOutput(result) object to a file? You're almost there. Your code will put the object in body , which is a Vec<u8> .