Skip to content

Instantly share code, notes, and snippets.

@tim-smart
Forked from manveru/listenpost.coffee
Created June 28, 2010 04:43
Show Gist options
  • Save tim-smart/455460 to your computer and use it in GitHub Desktop.
Save tim-smart/455460 to your computer and use it in GitHub Desktop.
router.post('/save').
bind (req, res, next) ->
buffer: null
req.addListener 'data', (chunk) ->
if buffer
temp_buffer: new Buffer buffer.length + chunk.length
buffer.copy temp_buffer, 0, 0
chunk.copy temp_buffer, buffer.length, 0
buffer: temp_buffer
else buffer: chunk
req.addListener 'end', ->
p buffer.toString('ascii')
# The same as
router.post('/save').module('post').bind (req, res, next) ->
p res.getBody 'ascii'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment