1.0.17 • Published 5 years ago

cos-uppy-plugin v1.0.17

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

cos-uppy-plugin

一个 Uppy 插件,解决腾讯云 COS 的上传问题,目前还不完善。已完成基本的 腾讯云 COS 临时

安装方式

yarn add cos-uppy-plugin

Typescript 使用前

declare module "cos-uppy-plugin" { let anything: any; export = anything }

使用方式

  1. 首先请查阅 Uppy 文档,了解 Uppy 的基本API.
  2. 集成插件到你 Uppy 对象
uppy.use(cosUppy, {
    bucket: 'bucket-12345678', // bucket id
    region: 'ap-beijing', // 所属 区域
    stsUrl: 'http://127.0.0.1:6275/cos/1256314360/upload/url', // STS API URL
    protocol: 'http'
})
属性说明
bucket腾讯云 COS bucket id
region腾讯云 COS 所属区域
stsUrl获取 “临时上传URL” 的(暂时不支持 sts 临时签名)
protocol使用协议

stsUrl

此部分与本插件无关,但是需要根据业务需要配置。

以下只说明上传原理。你需要配置获取 mark 线上项目的 url 地址。

原目的为 sts 临时 secret key 签发的获取地址,但因项目需要我们使用 获取 tokenURL(临时上传地址) 的方式上传。stsUrl 后端TokenURL生成逻辑目前在mark 项目中。根据腾讯云文档 https://cloud.tencent.com/document/product/436/36121 开发。

配置 stsUrl 提供后端服务

在 mark 上存在 Policy 的数据表

字段数据类型示例值用途必选
providerenum('cosSts','cosTokenUrl','s3')cosTokenUrl服务类型,现在仅 cosTokenUrl 有效
appidstring12345678COS 提供 APPID*
secretIdstringDPano5C...AxdHribCOS 提供 SecretId*
secretKeystringDPa...9LoQ1xHribCOS 提供 SecretKey*
bucketstringname-122837431COS 提供 bucket 名称*
regionstringAp-beijingCOS 提供 所属区*
detailJSON{"sign": true, "method": "PUT", "fileSizeLimit": 20971520, "fileTypeLimit": "image/oops", "image/jpeg", "image/png", "image/jpg"}tokenURL 签发详细配置,上传文件的类型、方式、文件大小类型限制。*
policyJSON{}COS 的 Policy 细则,暂时无用
signSecretstringHw1dpOkl1自用签名加密

detail

tokenURL 上传文件的限制.

{
    "sign": true,
    "method": "PUT",
    "fileSizeLimit": 20971520, //bytes
    "fileTypeLimit": ["image/oops", "image/jpeg", "image/png", "image/jpg"]
}
1.0.17

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago