var fs = require('fs');
var readableStream = fs.ReadStream('file_input.txt');
var writableStream = fs.WriteStream('file_output.txt');

readableStream.setEncoding('utf8');
readableStream.on('data', function(data){
    writableStream.write(data);
});

readableStream.on('close', function() {
    writableStream.end();
});


// También podemos hacerlo con el método pipe(), que se encarga de gestionar 
// los eventos de lectura y escritura
var fs = require('fs');
var readableStream = fs.ReadStream('file_input.txt');
var writableStream = fs.WriteStream('file_output.txt');

readableStream.pipe(writableStream);