parse-formdata

Parse formdata in Node

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
parse-formdata
411.0.25 years ago5 years agoMinified + gzip package size for parse-formdata in KB

Readme

parse-formdata
!npm version23 !build status45 !downloads89 !js-standard-style1011
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

See Also

License

MIT