Skip to content

Instantly share code, notes, and snippets.

View projenix's full-sized avatar

Sam Abouelata projenix

  • Casablanca, Morocco
View GitHub Profile
@projenix
projenix / transform.js
Last active August 29, 2015 14:08 — forked from Marak/transform.js
Transform incoming streams of HTTP data
module['exports'] = function logParser (hook) {
if (hook.req._readableState.endEmitted === true) {
//
// If hook.req.end has already been emitted, the request has already been recieved and fully bufferred
// In order to stream data you must open a streaming request ( not a browser GET request )
//
// To test a streaming Hook you can use Curl:
//
// echo "foo" | curl -X POST --data-binary @- http://hook.io/Marak/transform