post-oss
v0.2.1
Published
oss upload
Downloads
26
Readme
阿里云ossCDN SDK
阿里云OSS上传静态文件SDK
安装
npm i oss-post-cdn
参数
|配置项 | 必填 | 默认值 | 备注 | |---|----|---|---| | cwd | true | '' | 上传文件地址 | | keyUrl | false | --- | 秘钥校验地址 | | remoteAuth | true | '' | 秘钥校验码 | | uploadHtml | false | false | 默认不上传html文件 | | uploadError | false | null | 上传失败回调 | | uploadSuccess | false | null | 上传成功回调 | | uploadComplete | false | null | 上传完成回调 |
示例
import OSSCDN from 'oss-post-cdn';
import path from 'path';
new OSSCDN({
cwd: path.join(process.cwd(), 'static/book'),
keyUrl: 'http://localhost:6001/api/getRemoteKey',
remoteAuth: 'BWifxsyy',
uploadError: function (err, response, body) {
console.dir("uploadError_err:",err);
console.dir("uploadError_res:",body);
},
uploadSuccess: function (err, response, body) {
console.dir("uploadSuccess_err:",err);
console.dir("uploadSuccess_res:",body);
}
})