Coder Social home page Coder Social logo

gulp-oss-upload's Introduction

gulp-oss-upload

NPM version

A gulp plugin for uploading static file to aliyun oss(by official ali-oss sdk).

上传文件到阿里云 OSS 的 gulp 插件.

install

npm install gulp-oss-upload --save-dev

usage

var gulp = require('gulp');
var ossUpload = require('gulp-oss-upload');

gulp.task('publish-oss', function() {
    return gulp.src('./app.js')
               .pipe(ossUpload({
                    accessKeyId: 'your accessKeyId',
                    accessKeySecret: 'your accessKeySecret',
                    bucket: 'your bucket name',
                    region: 'oss-cn-hangzhou', // the bucket data region location, default is oss-cn-hangzhou
                    rootDir: 'v1' // upload file root directory in the bucket(optional)
                }));
});

This config will upload your current directory file app.js to v1/app.js in your bucket.

Required param details please view oss(options)

optional param

rootDir {string}

default: ''; //root directory

customObjectName {function}

/**
 * custom object name
 * 
 * @param objectName {string} default generate objectName
 * @param rootDir {string} options.rootDir
 * @param fileRelative {string} the file path relative to cwd path
 *
 * @return {string}
 */
function(objectName, rootDir, fileRelative) {
	return '';
}

reference

  • gulp-oss-up

    功能完全正常, 满足了我的需求(感谢作者), 但使用过程中发现 OSS SDK 不是阿里云官方的 SDK. objectDir 配置项也有点 bug, 因此自己参考着重写了一个.

one more thing

gulp-oss-upload's People

Contributors

necfol avatar ufologist avatar

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.