Created
December 14, 2013 14:56
-
-
Save flesch/7960192 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 fs = require("fs") | |
, UpperCaseStream = require("./UpperCaseStream") | |
; | |
var content = fs.createReadStream("content.txt"); | |
content.pipe(new UpperCaseStream()).pipe(process.stdout); |
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
Zombie ipsum brains reversus ab cerebellum viral inferno, brein nam rick mend grimes malum cerveau cerebro. De carne cerebro lumbering animata cervello corpora quaeritis. Summus thalamus brains sit, morbo basal ganglia vel maleficia? De braaaiiiins apocalypsi gorger omero prefrontal cortex undead survivor fornix dictum mauris. Hi brains mindless mortuis limbic cortex soulless creaturas optic nerve, imo evil braaiinns stalking monstra hypothalamus adventus resi hippocampus dentevil vultus brain comedat cerebella pitiutary gland viventium. Qui optic gland animated corpse, brains cricket bat substantia nigra max brucks spinal cord terribilem incessu brains zomby. The medulla voodoo sacerdos locus coeruleus flesh eater, lateral geniculate nucleus suscitat mortuos braaaains comedere carnem superior colliculus virus. Zonbi cerebellum tattered for brein solum oculi cerveau eorum defunctis cerebro go lum cerebro. Nescio brains an Undead cervello zombies. Sicut thalamus malus putrid brains voodoo horror. Nigh basal ganglia tofth eliv ingdead. |
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 UpperCaseStream = function(){ | |
this.readable = true; | |
this.writable = true; | |
}; | |
require("util").inherits(UpperCaseStream, require("stream")); | |
UpperCaseStream.prototype._transform = function(data){ | |
data = data ? data.toString() : ""; | |
this.emit("data", data.toUpperCase()); | |
}; | |
UpperCaseStream.prototype.write = function(){ | |
this._transform.apply(this, arguments); | |
}; | |
UpperCaseStream.prototype.end = function(){ | |
this._transform.apply(this, arguments); | |
this.emit("end"); | |
}; | |
module.exports = UpperCaseStream; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment