@fe_korey/cos-cdn
v1.0.0
Published
cos-nodejs-sdk-v5 upload static assests to cloud.tencent cdn
Readme
cos-cdn
本项目封装了腾讯云的 cos 上传服务。
使用方法
npm install cos-cdn -S -D命令行 demo
"cdn:stage": "cos-cdn-upload --Directory='xxx-stage' --Filepath='dist'",
"cdn:prod": "cos-cdn-upload --Directory='xxx' --Filepath='dist'"参数
| Property | Description | Default | | --------- | --------------------------------------------- | ------------------------------------- | | Directory | cdn 子路径(https://static-alpha.xxx.com/xxx/) | default(一般设为项目名称,如 juicy) | | Filepath | 你需要上传文件夹 | dist(从项目根路径开始) | | SecretId | SecretId | process.env.COS_SECRET_ID | | SecretKey | SecretKey | process.env.COS_SECRET_KEY | | Recursive | Recursive | true | | Bucket | Bucket | static | | Region | Region | cn-east |
本项目支持读取命令行参数或者读取根目录下
cos/config.js的配置文件。
优先级:根目录下 cos/config.js的配置文件 > 命令行参数 > 内置配置
内置 Config
const config = {
Directory: 'default',
Filepath: 'dist',
SecretId: process.env.COS_SECRET_ID,
SecretKey: process.env.COS_SECRET_KEY,
Recursive: true,
Bucket: 'static',
Region: 'cn-east',
Exclude: [],
};