title: Converting in node js base 64
body: <p>I have a var called data, which is essentially a string. I want to encode it to base 64, and I did:</p>
  
  <pre><code>data = new Buffer(data).toString('base64');
  </code></pre>
  
  <p>But all it becomes is AAAA. How do I fix this?</p>