2.0.1 • Published 6 years ago

publish-web-qiniu v2.0.1

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

publish-web-qiniu

通过正则匹配需要上传的文件后上传到七牛云

  • 已上传的文件不会再上传

安装

$ npm install --save-dev publish-web-qiniu

使用

var publishWeb = require('publish-web-qiniu');

publishWeb({
  webRoot: './dist',
  webGlobs: './**/*',
  qiniuAccess: '七牛云的access',
  qiniuSecret: '七牛云的secret',
  qiniuBucket: '上传到的bucket'
});

API

publishWeb(options)

options

webRoot

Type: string Default: null

web根路径

webGlobs

Type: glob Default: null

需要处理的文件glob,相对于options.webRoot目录

systemDir

Type: string Default: ./.publish-web-qiniu

用于写入已上传文件,相对于options.webRoot目录

onCollect

Type: function Default: null

  • 在收集文件时回调,传入参数(file),返回Promise,可在此修改文件内容
  • Promise对象应该resolve(file),如果resolve(false),则不上传该文件
onUpload

Type: function Default: null

  • 在上传文件时回调,传入参数({key,path}),返回({key,path})
  • key为七牛云上传的key
  • path为上传的文件路径

License

MIT