Upyun adapter for receiving upstreams. Particularly useful for handling streaming multipart file uploads from the Skipper body parser.
$ 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.
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()
});
});
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
MIT © 2015,
See LICENSE.md
.