koa2-multiparty

1.0.1 • Public • Published

koa2-multiparty

Build Status

It's similar to connect-multiparty, but koa2-multiparty is for KOA2 only.

This middleware will create temp files on your server and never clean them up. Thus you should not add this middleware to all routes; only to the ones in which you want to accept uploads. And in these endpoints, be sure to delete all temp files, even the ones that you don't use.

Usage

const multiparty = require('koa2-multiparty');
router.post('/upload', multiparty(), function(ctx) {
  console.log(ctx.req.body, ctx.req.files);
  // don't forget to delete all req.files when done
});

If you pass options to multiparty(), they are passed directly into multiparty.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i koa2-multiparty

Weekly Downloads

7

Version

1.0.1

License

MIT

Unpacked Size

7.08 kB

Total Files

6

Last publish

Collaborators

  • hong--boy