formidable-upload-koa

1.0.1 • Public • Published

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

/formidable-upload-koa/

    Package Sidebar

    Install

    npm i formidable-upload-koa

    Weekly Downloads

    20

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    769 kB

    Total Files

    12

    Last publish

    Collaborators

    • prosset