title: how to read memory stream of a pdf file and open it in nodejs
body: <p>Node Version: 5.7.1</p>
  
  <p>Platform: 64-bit (Windows)</p>
  
  <p>Hi, </p>
  
  <p>I am a newbie in working with node. I have built an app in electron (which uses node internally) which communicates with a .net restful service to fetch data from db and display it on the screen. One of the data has a pdf path on the server which i read onto the server and convert it into the memory stream and send it to the client app.</p>
  
  <p>The issue is how can i read this memory stream in node js and open the pdf file on my windows machine through adobe acrobat reader which is installed on my windows machine? Here is a sample code which i already tried :</p>
  
  <pre><code>var optionsGetPDF= {
         host: 'localhost',
         port: 8080,
         path: '/GetPDFDoc?docid=' + docid,
         method: 'GET'
  };
  
  var memStream = new memorystream(null, { readable: false });
  http.request(optionsGetPDF, function (res) {
       res.pipe(memStream);
       res.on('end', function () {
            alert(memStream.toString().length)
       });
  }).end();
  </code></pre>
  
  <p>So here I am getting the pdf file in the form of a memorystream and I just tried to alert the length to confirm, which is working fine. Now I want this memory stream to be again converted back to a PDF and then open it in the adobe acrobat installed on my windows machine.</p>
  
  <p>Any help is much appreciated.</p>
  
  <p>Thanks and Regards</p>
  
  <p>Shobhit</p>