oss_client/oss-client.rs
1use aliyun_openapi::prelude::*;
2use std::str::from_utf8;
3use bytes::{Bytes};
4
5#[tokio::main]
6async fn main() -> Result<(), Box<dyn std::error::Error>> {
7 let endpoint = "oss-cn-hangzhou.aliyuncs.com";
8 let ref http_client = reqwest::Client::new();
9 let oss = OSS { endpoint, http_client };
10 let bytes: Bytes = oss.get_object("eren-assets", "hello.txt").await?;
11 print!("object: {}", from_utf8(bytes.as_ref()).unwrap());
12 Ok(())
13}