Koa middleware for auto cleanup files created to disk by koa-body, koa-better-body, koa-multer or any multipart middleware that populate ctx.*.files.
MIT License
Koa middleware for auto cleanup files created to disk by:
ctx.request.files
, ctx.request.body.files
or ctx.req.files
The middleware will automatically remove any file in temporary location upon response end, throws or close.
Please report any issues!
Requires:
7.6.x
2
$ npm install koa-body-clean
const bodyClean = require('koa-body-clean')
const body = require('koa-body') // or koa-better-body, koa-multer, ...
const bodyClean = require('koa-body-clean')
const Koa = require('koa')
const app = new Koa()
app.use(body(bodyOptions))
app.use(bodyClean())
To skip a file from removal, set skip
attribute to true
in file object.
MIT