Skip to content

Instantly share code, notes, and snippets.

@sh1mmer
Created November 20, 2013 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sh1mmer/7569407 to your computer and use it in GitHub Desktop.
Save sh1mmer/7569407 to your computer and use it in GitHub Desktop.
raw text middleware
function bufferRawText(req,res,next) {
bufs = []
len = 0
req.on('data', function(d) {
bufs.push(d)
len += d.length
})
req.on('end', function() {
req.body = Buffer.concat(bufs, len)
next()
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment