1.0.7 • Published 7 years ago

fary-upyun-upload v1.0.7

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

fary-upyun-upload

A fary/koa2 middleware for uploading files to upyun cdn.

NPM version build status

Install

npm i fary-upyun-upload

Usage

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 above
  • fieldName?: string: default: upfile; the field name of the file
  • method?: string: default: POST; the method of the upload request
  • path?: string: default: /api/upload; the path of the upload request
  • parseResult?: default: (result) => ({ result }); the parser to respond the request
1.0.7

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago