parse-formdata

1.0.2 • Public • Published

parse-formdata

npm version build status downloads js-standard-style

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

Readme

Keywords

Package Sidebar

Install

npm i parse-formdata

Weekly Downloads

444

Version

1.0.2

License

MIT

Last publish

Collaborators

  • yoshuawuyts