title: How to get byte length of a base64 string in node.js?
body: <p>I'd like to calculate the size of an image file received as base64 encoded string like:</p>
  
  <pre><code>'data:image/png;base64,aBdiVBORw0fKGgoAAA...'
  </code></pre>
  
  <p>in order to  make sure that the file is not larger than certain size, say 5MB. </p>
  
  <p>How can I acheive this in node.js?</p>
  
  <p>I've seen similar question <a href="https://stackoverflow.com/a/3644167/7937129">here</a> but could not apply the answer in my node app as I get:</p>
  
  <pre><code>SyntaxError: Unexpected token :
  </code></pre>