formidable-upload-koa
v1.0.1
Published
Koa middleware based on formidable uploader
Downloads
93
Maintainers
Readme
formidable-upload-koa
Koa middleware based on formidable uploader.
Install
yarn add formidable-upload-koa
Usage
const koa = require("koa");
const Router = require("koa-router");
const koaForm = require("formidable-upload-koa");
const app = new koa();
const router = new Router();
const options = {
uploadDir: `${__dirname}/`,
keepExtensions: true
};
router.post("/uploader", koaForm(options), ctx => {
// Access to
// ctx.req.files
// ctx.req.fields
// The file has been uploaded in the folder choosen above.
});
app.use(router.routes());
app.listen(8080);
Test
yarn test
License
MIT