• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

bestander/gulp-deploy-azure-cdn: Gulp plugin for uploading files to Azure Blob S ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

bestander/gulp-deploy-azure-cdn

开源软件地址(OpenSource Url):

https://github.com/bestander/gulp-deploy-azure-cdn

开源编程语言(OpenSource Language):

JavaScript 100.0%

开源软件介绍(OpenSource Introduction):

gulp-deploy-azure-cdn

A Gulp plugin for for uploading files to Azure Blob Storage. Wraps a vanilla node package https://github.com/bestander/deploy-azure-cdn. It is perfect for deploying compiled assets to Microsoft Azure CDN as a last step in a Continuous Integration setup.

Features

  • Ability to execute a "dry run" of deployment. The logging will indicate all files that will be deleted or uploaded but no actual changes to the blob storage will be done
  • Ability to gzip content and set a proper content encoding. If gzipped file becomes larger than original then only the original file will be uploaded
  • Ability to recursively remove files in a path of Azure Blob Storage
  • Ability to control number of concurrent files to be uploaded to avoid network congestion
  • Grunt and gulp plugins available

Installing

npm install gulp-deploy-azure-cdn

Using

Deploying a set of files to a path in blob storage

var deployCdn = require('gulp-deploy-azure-cdn');
var gulp = require('gulp');
var gutil = require('gulp-util');

gulp.task('upload-app-to-azure', function () {
    return gulp.src(['*.js','*.json'], {
        base: 'node_modules/deploy-azure-cdn' // optional, the base directory in which the file is located. The relative path of file to this directory is used as the destination path
    }).pipe(deployCdn({
        containerName: 'test', // container name in blob
        serviceOptions: ['blobstoragename', '/OwQ/MyLongSecretStringFromAzureConfigPanel'], // custom arguments to azure.createBlobService
        folder: '1.2.35-b27', // path within container
        zip: true, // gzip files if they become smaller after zipping, content-encoding header will change if file is zipped
        deleteExistingBlobs: true, // true means recursively deleting anything under folder
        concurrentUploadThreads: 10, // number of concurrent uploads, choose best for your network condition
        metadata: {
            cacheControl: 'public, max-age=31530000', // cache in browser
            cacheControlHeader: 'public, max-age=31530000' // cache in azure CDN. As this data does not change, we set it to 1 year
        },
        testRun: false // test run - means no blobs will be actually deleted or uploaded, see log messages for details
    })).on('error', gutil.log);
});

Parameters

  • gulp.src {base} - use standard gulp configurations to skip some folders from relative file paths (example)
  • deployCdn function argument - azure cdn and upload configs
    • serviceOptions: [] - Custom arguments to azure.createBlobService. If this array contains a single argument it will be interpreted as a blob connection string. If it contains two arguments then they will be interpreted as a blob account name and access key, respectively.
    • containerName: null - container name, required
    • containerOptions: {publicAccessLevel: "blob"} - container options
    • folder: '', // path within container. Default is root directory of container
    • deleteExistingBlobs: true, // set it to false to skip recursive deleting blobs in folder
    • concurrentUploadThreads : 10, // number of concurrent uploads, choose best for your network condition
    • zip: false, // true if want to gzip the files before uploading. File will be zipped only if compressed file is smaller than original
    • metadata: {cacheControl: 'public, max-age=31556926'} // metadata for each uploaded file
    • testRun: false, // set to true if you just want to check connectivity and see deployment logs. No blobs will be removed or uplaoded.



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap