title: Nodejs decode base64 and save them into a file using streams
body: <p>Over my node.js application I decode base64 encoded images using the following line of code:</p>
  
  <pre><code> const fileDataDecoded = Buffer.from(base64EncodedfileData,'base64');
  </code></pre>
  
  <p>So far I can write a file with the following piece of code:</p>
  
  <pre><code> const fs = require('fs');
   ....
   const fileDataDecoded = Buffer.from(base64EncodedfileData,'base64');
   fs.writeFile("/tmp/test.png", fileDataDecoded, function(err) {
      //Handle Error
   });
  </code></pre>
  
  <p>Now what I want to achieve is the decoded files via the buffer to get written into a file via streams in order to acheive better efficiency on the executed application. </p>
  
  <p>In other words I want the filedata to get written at the same time that the data is getting base64-decoded, in order to write large files with an efficient way. If is not possible via a Buffer to stream base64 decoded data then I would like to know how is possible to decode base64 data.</p>