Git Product home page Git Product logo

gulp-qiniu-utils's Introduction

七牛云存储

gulp-qiniu-utils, such as upload, remove, prefetch, refresh and so on

七牛gulp插件,封装了上传,删除,预取,刷新等功能

Install:

Install with npm or cnpm

npm install --save-dev gulp-qiniu-utils
cnpm install --save-dev gulp-qiniu-utils

Usage:

var gulp = require('gulp')
var Qiniu = require('gulp-qiniu-utils')

var qiniuOptions = {
  ak: 'your accessKey',
  sk: 'your secretKey',
  zone: 'Zone_z2',//空间对应存储区域(华东:z0,华北:z1,华南:z2,北美:na0)
  bucket: '...',//七牛对应空间
  upload: {
    dir: './public/dist',//上传本地目录
    prefix: 'test/',//上传时添加的前缀,可省略
    except: /\.(html|js)$/ //上传时不上传文件的正则匹配
  },
  remote: {
    url: 'http...',//七牛空间域名
    prefix: {
      default: 'test/',//七牛空间默认前缀,如果下面三个相同可省略
      remove: 'test/',//七牛空间删除前缀
      prefetch: 'test/',//七牛空间预取前缀
      refresh: 'test/'//七牛空间刷新前缀
    }
  }
}

gulp.task('upload', function (cb) {
  var qiniu = new Qiniu(qiniuOptions)
  qiniu.remove()
    .then(r => qiniu.upload().then(files=>console.log(files))) //根据自己的需求来调用相应的方法
    .then(r => qiniu.refresh())
    .then(r => qiniu.prefetch())
    .then(r => cb())
})

PS:有什么问题或者建议可以在github上面提,觉得好用的话可以点个star

gulp-qiniu-utils's People

Contributors

compass-yan avatar justb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gulp-qiniu-utils's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.