当前位置:网站首页>腾讯云上传使用
腾讯云上传使用
2022-07-27 15:08:00 【Mr_ZCheng】
腾讯云上传使用
1:安装插件
cos-js-sdk-v5 yarn add cos-js-sdk-v5
2:导入
import Cos from 'cos-js-sdk-v5'
3:实例化
let cos = new Cos({
SecretId: 'COS_SECRETID', // 身份识别 ID
SecretKey: 'COS_SECRETKEY', // 身份密钥
});
4:使用
cos.putObject({
Bucket: 'dhf481229-1305249343', /* 存储桶: */
Region: 'ap-guangzhou', /* 存储桶所在地域,必须字段 */
Key: uid+'', /* 必须是字符串 */
StorageClass: 'STANDARD', // 固定值
Body: 文件对象, // 上传文件对象
onProgress: (progressData)=> {
// 上传进度
console.log(JSON.stringify(progressData));
}
}, (err, data)=> {
// 上传成功或者失败的回调
console.log(err || data);
});边栏推荐
- Database foundation
- How does vs2019 C language run multiple projects at the same time, how to add multiple source files containing main functions in a project and debug and run them respectively
- 数据库基础
- 合工大苍穹战队视觉组培训Day8——视觉,目标识别
- ES6数组的方法及伪数组转数组方法
- Flex flex flex box layout 2
- Shell programming specifications and variables
- Gradient ring progress bar
- AppStore 内购
- 技术实践干货 | 从工作流到工作流
猜你喜欢

内置对象(下)

How to extract tables from PDF through C /vb.net

动作捕捉系统用于柔性机械臂的末端定位控制

Day 7 summary & homework

day07 作业

Build a cloud native file system for media assets

Understand the basic properties of BOM and DOM

.NET Core with 微服务 - 什么是微服务

Flex flex flex box layout

.net core with microservices - what is a microservice
随机推荐
基于STM32的智能鱼缸设计
ES6数组的方法及伪数组转数组方法
牛客题目——链表的奇偶重排、输出二叉树的右视图、括号生成、字符流中第一个不重复的字符
This large model sparse training method with high accuracy and low resource consumption has been found by Alibaba cloud scientists! Has been included in IJCAI
Three table joint query 2
How does vs2019 C language run multiple projects at the same time, how to add multiple source files containing main functions in a project and debug and run them respectively
How to modify the decoding clock [chapter]
Two table joint query 1
2021-06-18 automatic assembly error in SSM project
Mobile page layout
牛客题目——最小的K个数
移动端基础
Niuke topic -- judge whether it is a complete binary tree or a balanced binary tree
Duplicate names in molecular class methods
.NET Core with 微服务 - 什么是微服务
Mobile end Foundation
这种精度高,消耗资源少的大模型稀疏训练方法被阿里云科学家找到了!已被收录到IJCAI
Motion capture system for end positioning control of flexible manipulator
项目练习:表格的查改功能
SAP UI5 FileUploader 的隐藏 iframe 设计明细