Skip to content

Promise based multipart form parser for KoaJS

License

Notifications You must be signed in to change notification settings

xiaoliang2233/async-busboy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Promise Based Multipart Form Parser

forked from 'async-busboy'

add complete method to delete tmpfile

add tmpdir option to select where to cache

Examples

Async/Await (using temp files)

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

About

Promise based multipart form parser for KoaJS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%