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}`
}