oss-cdn-helper
将静态资源上传到 OSS,并且可以去掉 html 文件的 .html
后缀,并修改 Content-Type
为 text/html
达到可以用 /example
代替 /example.html
访问网页的效果
-
安装相关依赖:
npm install oss-cdn-helper --save-dev -
部署并刷新 CDN
;;const process = async {const files = await OssCdnHelper;// files:// { fileName: '/target/index',// filePath:// '/Users/shianqi/workspace/node/oss-cdn-helper/test/build/index.html',// option: { headers: [Object] } },// { fileName: '/target/main',// filePath:// '/Users/shianqi/workspace/node/oss-cdn-helper/test/build/main.html',// option: { headers: [Object] } },// ....await OssCdnHelper;};process;
参数
await OssCdnHelper; await OssCdnHelper;
TODO
- 上传前清空目标文件夹