#cos #tencentcloud #tengxunyun

qcos

provide basic interface encapsulation of Tencent Cloud Object Storage (cos)

7 releases

0.1.6 Oct 16, 2022
0.1.5 Apr 7, 2022
Download history 15/week @ 2023-06-05 7/week @ 2023-06-12 25/week @ 2023-06-19 26/week @ 2023-06-26 13/week @ 2023-07-03 49/week @ 2023-07-10 19/week @ 2023-07-17 13/week @ 2023-07-24 11/week @ 2023-07-31 37/week @ 2023-08-07 45/week @ 2023-08-14 14/week @ 2023-08-21 17/week @ 2023-08-28 32/week @ 2023-09-04 31/week @ 2023-09-11 23/week @ 2023-09-18

103 downloads per month
Used in qcloud

MIT license

64KB
1.5K SLoC

qcos

异步版本 async/await

本包提供腾讯云对象存储(cos) 基本的操作,包括bucket创建及删除,对象的上传(支持分块传输)、下载、删除等。后续有时间会补充其他接口的实现。

How to use

use qcos::acl::{AclHeader, ObjectAcl};
use qcos::client::Client;
use qcos::objects::{mime, ErrNo, Objects};

#[tokio::main]
async fn main() {
    let client = Client::new(
        "Your secrect id",
        "Your secrect key",
        "bucket name",
        "region",
    );
    let mut acl_header = AclHeader::new();
    acl_header.insert_object_x_cos_acl(ObjectAcl::PublicRead);
    let res = client.put_object("test.png", "test.png", mime::IMAGE_PNG, Some(&acl_header)).await;
    if res.error_no == ErrNo::SUCCESS {
        println!("success");
    } else {
        println!("{}", res.error_message);
    }
}

如果操作成功,会打印出success, 否则会打印出失败原因。

更多的例子请参考examples

Installation

insert into your project's cargo.toml block next line

[dependencies]
qcos = "0.1.6"

Dependencies

~13–27MB
~492K SLoC