1.0.1 • Published 6 years ago

formidable-upload-koa v1.0.1

Weekly downloads
36
License
MIT
Repository
github
Last release
6 years ago

formidable-upload-koa

Travis Codecov

Koa middleware based on formidable uploader.

Formidable

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

1.0.1

6 years ago

1.0.0

6 years ago