Skip to content

Instantly share code, notes, and snippets.

@Raynos

Raynos/x.js Secret

Created August 14, 2012 19:20
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 Raynos/db5b2923e43def4daf74 to your computer and use it in GitHub Desktop.
Save Raynos/db5b2923e43def4daf74 to your computer and use it in GitHub Desktop.
mdm.on("connection", function (stream) {
var bufferWritable = through()
, bufferReadable = PauseStream().pause()
, buffer = duplex(bufferWritable, bufferReadable)
// effectively call stream.pause() and make sure its buffered until
// I can deal with that data
bufferWritable.pipe(stream).pipe(bufferReadable)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment