-
-
Save creationix/d05f75643bb0abdf2f90 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
function transform(input) { | |
var output = { read: read }; | |
input.onError = function (err) { return output.onError(err); }; | |
input.onEnd = function () { return output.onEnd(); }; | |
return output; | |
function read(callback) { | |
input.read(function (data) { | |
callback(data.toUpperCase()); | |
}); | |
} | |
} |
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 stream = makeMagicStream(); | |
stream.onEnd = onEnd; | |
stream.onError = onError; | |
return stream.read(onRead); | |
function onRead(data) { | |
console.log(data); | |
return stream.read(onRead); | |
} | |
function onError(err) { | |
throw err; | |
} | |
function onEnd() { | |
console.log("Done"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment