qbox / rust-sdk Goto Github PK
View Code? Open in Web Editor NEWGeneric Qiniu Resource Storage SDK
License: Other
Generic Qiniu Resource Storage SDK
License: Other
使用 upload_stream() 上传空文件的代码如下:
let config = Config::default();
let upload_policy = UploadPolicyBuilder::new_policy_for_bucket("xxx", &config)
.build();
let access_key = "xxx";
let secret_key = "xxx";
let credential = Credential::new(access_key, secret_key);
let upload_token = UploadToken::new(upload_policy, &credential);
let upload_manager = UploadManager::new(config);
println!("{:?}", upload_manager.for_upload_token(upload_token)?
.key("abc")
.upload_stream(&vec![][..], 0, "1.txt", None));
执行结果是
Err(QiniuError(Error {
retry_kind: UnretryableError,
error_kind: ResponseStatusCodeError(400, "parts param can\'t be empty"),
method: Some(POST),
url: Some("https://upload-z2.qiniup.com/buckets/xxx/objects/xxx/uploads/5e7c5f4b29a4714baa3e5a5e"),
request_id: Some("-ZoAAACWVcVVy_8V"), is_retry_safe: false }))
而使用 upload_file() 上传空文件不会报错:
// 1.txt 是一个空文件
let local_file_path = Path::new("1.txt");
let upload_manager = UploadManager::new(config);
println!("{:?}", upload_manager.for_upload_token(upload_token)?
.key("abc")
.upload_file(local_file_path, "1.txt", None));
上面的代码可以正常上传空文件。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.