Skip to content

hirako2000/koa-router-multer

Repository files navigation

koa-router-multer

Wrapper of koa-multer, for koa-router.

Tested with Koa 2.x, should work with Koa 1.x as well.

Codacy Badge Build Status Dependency Status devDependency Status license

Install

$ npm install --save koa-router-multer

Usage

Import the module

import multer from 'koa-router-multer';

Set the upload folder for file uploads

var upload = multer({ dest: 'uploads/' });

Example of resource

route.post('/upload', upload.single('file'), function * (next) {
  var filename = this.req.file.filename;
  var mimeType = this.req.file.mimetype;
  ...
  ...
});

See more, koa-multer

License

MIT