https://github.com/hirako2000/koa-router-multer
Minimalist Wrapper of multer, for koa-router
https://github.com/hirako2000/koa-router-multer
koa koa-multer koa-router koa2 multer multipart-uploads upload
Last synced: about 1 month ago
JSON representation
Minimalist Wrapper of multer, for koa-router
- Host: GitHub
- URL: https://github.com/hirako2000/koa-router-multer
- Owner: hirako2000
- License: mit
- Created: 2016-05-14T14:59:22.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-10-13T18:37:04.000Z (over 6 years ago)
- Last Synced: 2025-03-16T14:36:33.817Z (about 2 months ago)
- Topics: koa, koa-multer, koa-router, koa2, multer, multipart-uploads, upload
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# koa-router-multer
Wrapper of koa-multer, for koa-router.Tested with Koa 2.x, should work with Koa 1.x as well.
[](https://app.codacy.com/app/hirako2000/koa-router-multer?utm_source=github.com&utm_medium=referral&utm_content=hirako2000/koa-router-multer&utm_campaign=Badge_Grade_Dashboard)
[](https://travis-ci.org/hirako2000/koa-router-multer)
[](https://david-dm.org/hirako2000/koa-router-multer)
[](https://david-dm.org/hirako2000/koa-router-multer#info=devDependencies)
[](https://github.com/hirako2000/koa-router-multer/blob/master/LICENSE)## Install
```sh
$ npm install --save koa-router-multer
```## Usage
Import the module
```js
import multer from 'koa-router-multer';
```Set the upload folder for file uploads
```js
var upload = multer({ dest: 'uploads/' });
```
Example of resource
```js
route.post('/upload', upload.single('file'), function * (next) {
var filename = this.req.file.filename;
var mimeType = this.req.file.mimetype;
...
...
});
```See more, [koa-multer](https://github.com/koa-modules/multer)
## License
[MIT](LICENSE)