Crates.io | qiniu-objects-manager |
lib.rs | qiniu-objects-manager |
version | 0.2.4 |
source | src |
created_at | 2022-04-07 09:54:05.670642 |
updated_at | 2023-12-26 08:01:27.858296 |
description | Qiniu Objects Manager for Rust |
homepage | https://www.qiniu.com |
repository | https://github.com/qiniu/rust-sdk.git |
max_upload_size | |
id | 563576 |
size | 225,597 |
基于 qiniu-apis
提供针对七牛对象的管理功能 (同时提供阻塞客户端和异步客户端,异步客户端则需要启用 async
功能),
主要负责七牛对象的列举和操作。
ureq
[dependencies]
qiniu-objects-manager = { version = "0.2.1", features = ["ureq"] }
[dependencies]
qiniu-objects-manager = { version = "0.2.1", features = ["async", "isahc"] }
[dependencies]
qiniu-objects-manager = { version = "0.2.1", features = ["async", "reqwest"] }
c_ares
启用 c-ares
库作为 DNS 解析器
trust_dns
启用 trust-dns
库作为 DNS 解析器
dns-over-https
启用 trust-dns
库作为 DNS 解析器,并使用 DOH 协议
dns-over-tls
启用 trust-dns
库作为 DNS 解析器,并使用 DOT 协议
use qiniu_objects_manager::{apis::credential::Credential, ObjectsManager};
let credential = Credential::new("abcdefghklmnopq", "1234567890");
let object_manager = ObjectsManager::new(credential);
let bucket = object_manager.bucket("test-bucket");
let response = bucket.stat_object("test-key").call()?;
let object = response.into_body();
println!("fsize: {}", object.get_size_as_u64());
println!("hash: {}", object.get_hash_as_str());
println!("mime_type: {}", object.get_mime_type_as_str());
use qiniu_objects_manager::{apis::credential::Credential, ObjectsManager, OperationProvider};
use futures::stream::TryStreamExt;
let credential = Credential::new("abcdefghklmnopq", "1234567890");
let object_manager = ObjectsManager::new(credential);
let bucket = object_manager.bucket("test-bucket");
let mut ops = bucket.batch_ops();
ops.add_operation(bucket.stat_object("test-file-1"));
ops.add_operation(bucket.stat_object("test-file-2"));
ops.add_operation(bucket.stat_object("test-file-3"));
ops.add_operation(bucket.stat_object("test-file-4"));
ops.add_operation(bucket.stat_object("test-file-5"));
let mut iter = ops.call();
while let Some(object) = iter.next() {
let object = object?;
println!("fsize: {:?}", object.get_size_as_u64());
println!("hash: {:?}", object.get_hash_as_str());
println!("mime_type: {:?}", object.get_mime_type_as_str());
}
use qiniu_objects_manager::{apis::credential::Credential, ObjectsManager};
use futures::stream::TryStreamExt;
let credential = Credential::new("abcdefghklmnopq", "1234567890");
let object_manager = ObjectsManager::new(credential);
let bucket = object_manager.bucket("test-bucket");
let mut iter = bucket.list().iter();
while let Some(object) = iter.next() {
let object = object?;
println!("fsize: {:?}", object.get_size_as_u64());
println!("hash: {:?}", object.get_hash_as_str());
println!("mime_type: {:?}", object.get_mime_type_as_str());
}
use qiniu_objects_manager::{apis::credential::Credential, ObjectsManager};
let credential = Credential::new("abcdefghklmnopq", "1234567890");
let object_manager = ObjectsManager::new(credential);
let bucket = object_manager.bucket("test-bucket");
let response = bucket.stat_object("test-key").async_call().await?;
let object = response.into_body();
println!("fsize: {}", object.get_size_as_u64());
println!("hash: {}", object.get_hash_as_str());
println!("mime_type: {}", object.get_mime_type_as_str());
use qiniu_objects_manager::{apis::credential::Credential, ObjectsManager, OperationProvider};
use futures::stream::TryStreamExt;
let credential = Credential::new("abcdefghklmnopq", "1234567890");
let object_manager = ObjectsManager::new(credential);
let bucket = object_manager.bucket("test-bucket");
let mut ops = bucket.batch_ops();
ops.add_operation(bucket.stat_object("test-file-1"));
ops.add_operation(bucket.stat_object("test-file-2"));
ops.add_operation(bucket.stat_object("test-file-3"));
ops.add_operation(bucket.stat_object("test-file-4"));
ops.add_operation(bucket.stat_object("test-file-5"));
let mut stream = ops.async_call();
while let Some(object) = stream.try_next().await? {
println!("fsize: {:?}", object.get_size_as_u64());
println!("hash: {:?}", object.get_hash_as_str());
println!("mime_type: {:?}", object.get_mime_type_as_str());
}
use qiniu_objects_manager::{apis::credential::Credential, ObjectsManager};
use futures::stream::TryStreamExt;
let credential = Credential::new("abcdefghklmnopq", "1234567890");
let object_manager = ObjectsManager::new(credential);
let bucket = object_manager.bucket("test-bucket");
let mut stream = bucket.list().stream();
while let Some(object) = stream.try_next().await? {
println!("fsize: {:?}", object.get_size_as_u64());
println!("hash: {:?}", object.get_hash_as_str());
println!("mime_type: {:?}", object.get_mime_type_as_str());
}
1.70.0
This project is licensed under the MIT license.