koa-body-clean

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

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
koa-body-clean
311.0.05 years ago5 years agoMinified + gzip package size for koa-body-clean in KB

Readme

koa-body-clean
!nodenodenode-url !npmnpmnpm-url !teststeststests-url !codecovcodecovcodecov-url !depsdepsdeps-url !ddepsddepsddeps-url !standardstandardstandard-url
Koa middleware for auto cleanup files created to disk by:


The middleware will automatically remove any file in temporary location upon response end, throws or close.
Please report any issues!

Installation

Requires:
  • node >= 7.6.x
  • koa >= 2

$ npm install koa-body-clean

Usage

const bodyClean = require('koa-body-clean')

Example

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())

Skipping files

To skip a file from removal, set skip attribute to true in file object.

License

MIT