parse-formdata-damon
v0.0.1
Published
Parse formdata in Node
Downloads
3
Readme
parse-formdata
Parse formdata in Node.
Usage
var parseFormdata = require('parse-formdata')
var http = require('http')
http.createServer(function (req, res) {
parseFormdata(req, function (err, data) {
if (err) throw err
console.log('fields:', data.fields)
data.parts.forEach(function (part) {
console.log('part:', part.fieldname)
})
res.end('Be kind to each other')
})
}).listen(8080)
API
parseFormdata(req, cb(err, data))
Parse formdata from an HTTP request. data
has the following fields:
- fields: key-value data from fields
- parts: an array of streams for the multipart file uploads
- preamble: an array of data from the
preamble
event - epilogue: an array of data from the
epilogue
event