0.3.4 • Published 7 years ago

cdn-uploader v0.3.4

Weekly downloads
38
License
-
Repository
github
Last release
7 years ago

cdn-uploader

Upload files to one or more CDN through FTP, it is also a gulp plugin.

NPM version Build Status

Usage

var gulp = require('gulp')
var cdnUploader = require('cdn-uploader')
var CDNs = [{
  slot: 'upyun',
  api_host: 'v0.api.upyun.com',
  operator: 'operator',
  bucket: 'bucket',
  password: process.env.CDN_PWD
}, {
  host: 'ftp.keycdn.com'
  user: 'username'
  password: process.env.CDN_PWD
}]

gulp.task('cdn', function () {
  return gulp.src('dist/static/**')
    .pipe(cdnUploader('/static', CDNs))
})

export your ftp password to shell:

export CDN_PWD='ftppassword'

API

var cdnUploader = require('cdn-uploader')

cdnUploader(remoteFolder, cdnList, options)

  • remoteFolder: {String}, FTP folder
  • cdnList: {Array}, one or more CDN options, could be FTP options or plugin specific options
  • options: {Object}, options of cdn-uploader, keys include:
    • cache: Cached file list path, set false to disable cache mechanism, default to .cdnUploaderCache

Return a through stream.

Plugins

You can set slot in CDN options to enable the corresponding plugins. FTP plugin is used as default plugin when slot is not set or not valid.

UPYUN

UPYUN plugin use the UPYUN HTTP REST API to upload files.

You should set slot: upyun in CDN options to enable this plugin. Besides, field api_host, operator, bucket and password are also required.

License

MIT © Teambition

0.3.4

7 years ago

0.3.3

7 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.2.3

8 years ago

0.2.2

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.1

9 years ago