forked from 'async-busboy'
add complete method to delete tmpfile
add tmpdir option to select where to cache
import asyncBusboy from 'async-busboy-plus';
// Koa 2 middleware
async function(ctx, next) {
const {files, fields, complete} = await asyncBusboy(ctx.req, {
// default to os.tmpdir
tmpdir: '/tmp'
});
// Make some validation on the fields before upload to S3
if ( checkFiles(fields) ) {
files.map(uploadFilesToS3)
} else {
return 'error';
}
complete()
}