title: Convert string to buffer Node
body: <p>I am using a library which on call of a function returns the toString of a buffer.</p>
  
  <p>The exact code is </p>
  
  <pre><code>return Buffer.concat(stdOut).toString('utf-8');
  </code></pre>
  
  <p>But I don't want string version of it.</p>
  
  <p>I just want the buffer</p>
  
  <p>So how to convert string back to buffer.</p>
  
  <p>Something like if</p>
  
  <pre><code>var bufStr = Buffer.concat(stdOut).toString('utf-8');
  //convert bufStr back to only Buffer.concat(stdOut).
  </code></pre>
  
  <p>How to do this?</p>
  
  <p>I tried doing </p>
  
  <pre><code>var buf = Buffer.from(bufStr, 'utf-8');
  </code></pre>
  
  <p>But it throws utf-8 is not a function.
  When I do </p>
  
  <pre><code>var buf = Buffer.from(bufStr);
  </code></pre>
  
  <p>It throws TypeError : this is not a typed array.</p>
  
  <p>Thanks</p>