Crates.io | qiniu-download-manager |
lib.rs | qiniu-download-manager |
version | 0.2.4 |
source | src |
created_at | 2022-04-29 12:57:04.465903 |
updated_at | 2023-12-26 08:12:06.493725 |
description | Qiniu Download Manager for Rust |
homepage | https://www.qiniu.com |
repository | https://github.com/qiniu/rust-sdk.git |
max_upload_size | |
id | 577350 |
size | 98,703 |
基于 qiniu-apis
提供针对七牛对象的下载功能 (同时提供阻塞客户端和异步客户端,异步客户端则需要启用 async
功能)。
ureq
[dependencies]
qiniu-download-manager = { version = "0.2.1", features = ["ureq"] }
[dependencies]
qiniu-download-manager = { version = "0.2.1", features = ["async", "isahc"] }
[dependencies]
qiniu-download-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_download_manager::{apis::credential::Credential, DownloadManager, StaticDomainsUrlsGenerator, UrlsSigner};
let bound_domain = "my-domain.com"; // 直接设置绑定的空间域名
let object_name = "test-object";
let download_manager = DownloadManager::new(UrlsSigner::new(
Credential::new("abcdefghklmnopq", "1234567890"),
StaticDomainsUrlsGenerator::builder(bound_domain)
.use_https(false)
.build(), // 设置为 HTTP 协议
));
download_manager
.download(object_name)?
.to_path("/home/qiniu/test.png")?;
use qiniu_download_manager::{
apis::{credential::Credential, http_client::BucketDomainsQueryer},
DownloadManager, EndpointsUrlGenerator, UrlsSigner,
};
let bucket_name = "test-bucket"; // 查询空间绑定的域名
let object_name = "test-object";
let credential = Credential::new("abcdefghklmnopq", "1234567890");
let download_manager = DownloadManager::new(UrlsSigner::new(
credential.to_owned(),
EndpointsUrlGenerator::builder(BucketDomainsQueryer::new().query(credential, bucket_name))
.use_https(false)
.build(), // 设置为 HTTP 协议
));
download_manager
.async_download(object_name)
.await?
.async_to_path("/home/qiniu/test.png")
.await?;
1.70.0
This project is licensed under the MIT license.