title: What is the NodeJs equivalent to Java getBytes()
body: <p>I need to perform a Java function in NodeJs.</p>
  
  <pre><code>string.getBytes()
  </code></pre>
  
  <p>In Java, this translates a string to a byte array <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html" rel="nofollow"><code>byte[]</code></a>.</p>