Skip to content

JerryC8080/skipper-upyun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Upyun Adapter for Skipper

npm version NPM downloads

Upyun adapter for receiving upstreams. Particularly useful for handling streaming multipart file uploads from the Skipper body parser.

Installation

$ npm install skipper-upyun --save

Also make sure you have skipper itself installed as your body parser. This is the default configuration in Sails as of v0.10.

Usage

req.file('filename')
.upload({
  adapter: require('skipper-upyun'),
  bucket: 'YOUR_UPYUN_BUCKET_NAME',
  operator: 'OPERATOR_TO_BUCKET',
  password: 'PASSWORD_FOR_OPERATOR',
  endpoint: 'YOUR_ENDPOINT',
  apiVersion: 'API_VERSION'
}, function whenDone(err, uploadedFiles) {
  if (err) return res.badRequest(err);
  else return res.ok({
    files: uploadedFiles,
    textParams: req.params.all()
  });
});

Options

Option Type Description
dirname ((string)) Optional. The path to the directory on the remote filesystem where file uploads should be streamed.
bucket ((string)) Your upyun bucket's name.
operator ((string)) Operator which is granted permisson to bucket
password ((string)) Passowrd for the operator which is granted permisson to bucket
endpoint ((string)) The value can be these(leave blank to let sdk auto select the best one): ctcc or v1: China Telecom、cucc or v2: China Unicom、cmcc or v3 China Mobile、v0 or any other string: Will use v0.api.upyun.com (auto detect routing)
apiVersion ((string)) API version
perMaxBytes ((integer)) Upload limit for per coming file (in bytes), falsy means no limit
acceptTypes ((array)) Upload limit for per file (in content-type), falsy means accept all the type

For more detailed information of Upyun, see the Upyun sdk

License

MIT © 2015,

Huang JerryC,

See LICENSE.md.

About

A simple skipper adapter for upyun

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published