Skip to content

Instantly share code, notes, and snippets.

@zmts
Created March 13, 2017 12:32
Show Gist options
  • Save zmts/f321d36f51d165337f5c4b10c956d1e7 to your computer and use it in GitHub Desktop.
Save zmts/f321d36f51d165337f5c4b10c956d1e7 to your computer and use it in GitHub Desktop.
// https://github.com/felixge/node-formidable
function formidablePromise (req, opts) {
return new Promise(function (resolve, reject) {
var form = new formidable.IncomingForm(opts)
form.parse(req, function (err, fields, files) {
if (err) return reject(err)
resolve({ fields: fields, files: files })
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment