Op zaterdag 17 januari 2015 19:19:13 UTC+1 schreef Luca Morandini:
>
> On 17/01/15 03:21, Roelof Wobben wrote: 
> > 
> > Does anyone have a tip if this can be done and how I can do this ? 
>
> var fs= require("fs"); 
> var stream= require("stream"); 
> var util= require("util"); 
> var inFile= fs.createReadStream("in.txt", {encoding: "utf8"}); 
> var outFile= fs.createWriteStream("out.txt"); 
>
> var UpperTransform = function(options) { 
>      if (!(this instanceof UpperTransform)) { 
>        return new UpperTransform(options); 
>      } 
>      stream.Transform.call(this, options); 
> }; 
> util.inherits(UpperTransform, stream.Transform); 
>
> UpperTransform.prototype._transform = function(line, enc, done) { 
>      this.push(line.toUpperCase()); 
>      done(); 
> }; 
>
> var upper = new UpperTransform({ objectMode: true }); 
>
> upper.on("error", function(err) { 
>    console.log(err) 
> }); 
>
> inFile.pipe(upper).pipe(outFile); 
>
> Enjoy ! 
>
> Luca Morandini 
> Data Architect - AURIN project 
> Melbourne eResearch Group 
> Department of Computing and Information Systems 
> University of Melbourne 
>
>
>

Thanks, now I see why plugin like through are easier to use and to 
understand. 

Roelof
 

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/f7d5a259-c930-4d6d-a974-f4238a4ea37c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to