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

前端 未结 2 1900
盖世英雄少女心
盖世英雄少女心 2021-01-15 12:53

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         


        
2条回答
  •  离开以前
    2021-01-15 13:05

    You're almost there. Your code will put the object in body, which is a Vec.

    To write the contents of body to a file:

    use std::io::Write;
    use std::fs::File;
    
    let mut file = File::create("/path/to/my-object").expect("create failed");
    file.write_all(&body).expect("failed to write body");
    

提交回复
热议问题