-
-
Save Raynos/62f50dc439943f35db03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var shoe = require("shoe") | |
, MuxDemux = require("mux-demux") | |
module.exports = createShoeStream | |
function createShoeStream(uri) { | |
var stream = shoe(uri) | |
, mdm = MuxDemux() | |
mdm.pipe(stream).pipe(mdm) | |
return mdm | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var shoe = require("shoe") | |
, MuxDemux = require("mux-demux") | |
module.exports = createShoeConnection | |
function createShoeConnection(options, callback) { | |
if (typeof options === 'function') { | |
callback = options | |
options = {} | |
} | |
return shoe(options, interceptStream) | |
function interceptStream(stream) { | |
var mdm = MuxDemux() | |
mdm.on("connection", callback) | |
stream.pipe(mdm).pipe(stream) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment