free-midway-component
v1.0.54
Published
## publish.bat是npm发布的脚本,使用之前请把修改的东西提交保存
Downloads
132
Readme
midway封装库
publish.bat是npm发布的脚本,使用之前请把修改的东西提交保存
1.所有的东西都要导出来才能用,包括相对地址引用的内容
npm 发布相关
npm version patch
更新版本号
npm publish
发布
npm unpublish <包名(@版本)>
删除指定包的依赖(指定版本)
npm i free-midway-component@latest
项目中升级最新版本
使用说明:
引入工具
upload: 文件上传功能
自行修改的属性:
|属性名|说明|默认值|可选值|
|:-:|:-:|:-:|:-:|
|use|是否使用|true|false|
|modelNames|涉及文件上传的表|-|[写表名]|
|fileSize|上传允许文件的最大值|100mb|随便写|
|whitelist|后缀白名单|['.jpg','.jpeg','.png','.gif','.bmp','.wbmp','.webp','.tif','.tiff','.psd','.svg','.xml','.pdf','.zip','.gz','.gzip','.mp3','.mp4','.avi']|[随便写]|
|tempdir|临时上传路径|join(process.cwd(), 'uploadTemp')
|是存储位置就行|
|realdir|实际上传存储地址|join(process.cwd(), 'upload')
|是存储位置就行|
使用
上传: ${项目前缀 koa.globalPrefix}/api/files/xxxxx/upload 读取/下载: ${项目前缀 koa.globalPrefix}/files/xxxx
bull: 任务队列
任务队列强依赖于redis,redis版本>=5; config中添加:
bull: {
defaultQueueOptions: {
redis: {
port: 6379,
host: '127.0.0.1',
// password: 'xxxxxx'
},
},
},
每天执行一次