Giter Site home page Giter Site logo

gulp-upload-qcloud's Introduction

gulp-upload-qcloud

腾讯云上传 gulp 插件

Install

npm install --save-dev gulp-upload-qcloud

Usage

const gulp = require('gulp');
const uploadQcloud = require('gulp-upload-qcloud');

gulp.task('upload', () => {
  return gulp.src(['test/**/*.*'])
    .pipe(uploadQcloud({
      AppId: 'STRING_VALUE',
      SecretId: 'STRING_VALUE',
      SecretKey: 'STRING_VALUE',
      Bucket: 'STRING_VALUE',
      Region: 'STRING_VALUE',
      Prefix: 'demo/sub'
      OverWrite: false
    }));
});

API

uploadQcloud([options])

options

Type: Object

There are 7 options:

  • AppId(string): 注册或登录 腾讯云 获取您的AppId。
  • SecretId(string): 到 腾讯云控制台密钥管理 获取您的项目 SecretId 和 SecretKey。
  • SecretKey(string): 同 SecretId。
  • Bucket(string): 到 COS 对象存储控制台 创建存储桶,得到 Bucket(存储桶名称) 和 Region(地域名称)。
  • Region(string): Bucket 所在区域。枚举值请见:Bucket 地域信息
  • Prefix(string): 自定义文件前缀,例如本地文件路径 img.png ,设置了 Prefix: 'demo',最终腾讯云路径为 demo/img.png,默认为空。
  • OverWrite(string): 是否覆盖同名文件,默认 false。
! AppIdBucket 的说明:

腾讯云官方 api 修改,去掉 AppId 概念,Bucket 需要传入这样的格式 test-1250000000。本插件,兼容两种配置方式,示例如下:

// old api options
const options = {
  AppId: 'your AppId',
  Bucket: 'old Bucket',
  ...
};
// new api options
const options = {
  Bucket: 'AppId-Bucket',
  ...
};

TIPS

该插件基于 腾讯云 COS Nodejs SDK V5 构建,可参考腾讯云官方文档 Node.js SDK

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.