t-comm
Version:
专业、稳定、纯粹的工具库
39 lines (38 loc) • 1.18 kB
TypeScript
/**
* 获取腾讯云 COS SDK 实例
* 创建并返回一个配置好的 COS 客户端实例
* @param secretId - 腾讯云 SecretId
* @param secretKey - 腾讯云 SecretKey
* @returns COS SDK 实例
* @example
* ```ts
* const cos = getCOSInstance('your-secret-id', 'your-secret-key');
* // 使用 cos 实例进行文件操作
* ```
*/
export declare function getCOSInstance(secretId: string, secretKey: string): import("cos-nodejs-sdk-v5");
/**
* COS 文件上传进度回调函数
* 显示上传进度、速度、已上传大小和总大小
* @param info - 上传进度信息
* @param info.percent - 上传进度百分比(0-1)
* @param info.speed - 上传速度(字节/秒)
* @param info.total - 文件总大小(字节)
* @param info.loaded - 已上传大小(字节)
* @example
* ```ts
* onUploadCOSProgress({
* percent: 0.5,
* speed: 1024000,
* total: 10240000,
* loaded: 5120000
* });
* // 输出: 总共:9.77 MB,已上传:4.88 MB,进度:50%,速度:1000.00 KB/s
* ```
*/
export declare function onUploadCOSProgress(info: {
percent: number;
speed: number;
total: number;
loaded: number;
}): void;