1.0.7 • Published 8 years ago
fary-upyun-upload v1.0.7
fary-upyun-upload
A fary/koa2 middleware for uploading files to upyun cdn.
Install
npm i fary-upyun-uploadUsage
const createApp = require('fary');
const upyunUpload = require('fary-upyun-upload');
createApp({
middlewares: [
upyunUpload({
upyunConfig: {
bucket: '',
operator: '',
password: '',
// the origin to access the file.
// if not specified, will use the default host provided by Upyun.
publicOrigin: '',
// the dir on the server to upload
remoteDir: '',
}
})
]
})Or use with koa2 directly.
Options
upyunConfig: upyun config, available properties are list abovefieldName?: string: default:upfile; the field name of the filemethod?: string: default:POST; the method of the upload requestpath?: string: default:/api/upload; the path of the upload requestparseResult?: default:(result) => ({ result }); the parser to respond the request