title: Node: Read data, transform it and write into file using streams and pipe
body: <p>I try to read a string from a text file, encode it and save into a file. I wanna use <code>pipe</code> in order to transfer <code>hash</code> from <code>ReadStream</code> to <code>WriteStream</code>. But I don't know how to transform the changed data. My code:</p>
  
  <pre><code>const crypto = require('crypto');
  const fs = require('fs');
  let hash = crypto.createHash('md5');
  var rs = fs.createReadStream('./passwords.txt');
  var ws = fs.createWriteStream('./new_passwords.txt');
  
  
  rs.on('data', function(d) {
    hash.update(d);
  });
  rs.on('end', function(d) {
      console.log(hash.digest('hex'))
  });
  </code></pre>