0.3.0 • Published 5 years ago

@koa-framework/koa-multer v0.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

@luobotang/koa-multer

安装

npm i @luobotang/koa-multer

配置

module.exports = {
  multer: {
    // options pass to 'multer'
  }
}

使用

路由:

router.post('/form', interceptor.multer.single('file'), controller.foo.form)

Controller:

exports.form = async (ctx) => {
  const { originalname, size, mimetype } = ctx.file
  ctx.body = `${originalname} ${size} ${mimetype}`
}