title: How do I convert object to string in node js
body: <p>I am very new to node js. I am trying to create a simple coap client and server using node js. I could create a server on which a text file resides.
  I want to access that from the client.</p>
  
  <pre><code>var coap = require('coap');
  var str = "";
  var req = coap.request("coap://localhost:5683");
  req.on("response", function(chunk){
      str +=chunk;    
      console.log(str);   
      chunk.pipe(process.stdout);
  });
  </code></pre>
  
  <p>This code is giving me the output as [object Object]. How do I get the string form of this. </p>