fluent_qcloud_cos 0.2.2
fluent_qcloud_cos: ^0.2.2 copied to clipboard
Tencent Cloud Object Storage Upload Plugin, supports fast upload and progress display 腾讯云对象存储上传插件, 支持分快上传, 进度显示.
fluent_qcloud_cos #
一个纯dart实现的腾讯云对象存储的包.
Features #
- 简单文件上传
- 分快上传(断点续传).
Usage #
final handler =
ObjectStoragePutObjectEventHandler(taskId: "putObjectSimple");
handler.onFailed = (event) {
cosLog(event.errorMessage ?? "未知错误");
};
handler.onSuccess = (event) {
cosLog("上传成功");
};
handler.onProgress = (event) {
cosLog("${event.currentSize}/${event.totalSize}");
};
/// 如果要异步上传请勿使用 await 关键字, 并传入 handler 以获取进度和错误
FluentQCloudCos.putObject(
ObjectStoragePutObjectRequest(
taskId: "putObjectFileSizeMoreThan20M",
filePath: largeFilePath,
bucketName: bucketName!,
objectName: "file-small.jpg",
accessKeyId: secretId!,
accessKeySecret: secretKey!,
securityToken: "",
expiredTime:
DateTime.now().add(const Duration(days: 50)).millisecondsSinceEpoch,
region: region!,
),
handler: handler,
);