title: NodeJS writeStream empty file
body: <p>I am trying to use nodeJS to save a processed image stored in a base64 string.</p>
  
  <pre><code>var buff = new Buffer(base64data,'base64');
  console.log(base64data);
  
  var stream = fs.createWriteStream('/path/to/thefile.png');
  stream.write(buff)
  stream.end()
  </code></pre>
  
  <p>However, the resulting file is empty.</p>
  
  <p>When I take the output of <code>console.log(base64data);</code> and decode it locally, it produces a valid png binary, so why is the file empty?</p>
  
  <p>The file is a 3600x4800 px png file (i.e. it's huge), could this be a factor?</p>
  
  <p>Also, I tried <code>writeFile</code> as well, no luck.</p>
  
  <p>And yes, <code>fs</code> is <code>require('fs')</code></p>
  
  <p>Thanks</p>