title: Javascript - How to convert buffer to a string?
body: <p>This is example of converting String to a Buffer and back to String:</p>
  
  <pre><code>let bufferOne = Buffer.from('This is a buffer example.');
  console.log(bufferOne);
  
  // Output: &lt;Buffer 54 68 69 73 20 69 73 20 61 20 62 75 66 66 65 72 20 65 78 61 6d 70 6c 65 2e&gt;
  
  let json = JSON.stringify(bufferOne);
  let bufferOriginal = Buffer.from(JSON.parse(json).data);
  console.log(bufferOriginal.toString('utf8'));
  // Output: This is a buffer example.
  </code></pre>
  
  <p>Now imagine someone just give you only this string as a starting point:<br>
  <code>&lt;Buffer 54 68 69 73 20 69 73 20 61 20 62 75 66 66 65 72 20 65 78 61 6d 70 6c 65 2e&gt;</code> <br>- how would you convert it to regular value of this 'buffer' string?</p>
  
  <p>I tried with:</p>
  
  <pre><code>   let buffer = '&lt;Buffer 54 68 69 73 20 69 73 20 61 20 62 75 66 66 65 72 20 65 78 61 6d 70 6c 65 2e&gt;'
      json = JSON.stringify(buffer);
      console.log(json);
  </code></pre>
  
  <p>Gives output:</p>
  
  <pre><code>"&lt;Buffer 54 68 69 73 20 69 73 20 61 20 62 75 66 66 65 72 20 65 78 61 6d 70 6c 65 2e&gt;"
  </code></pre>