title: Node js Converting pdf Buffer back to pdf
body: <p>I have created a pdf with the browser in Javascript and sent it via post to the server using this code:</p>
  
  <pre><code>var blob = pdf.output('blob')
  var xhr = new XMLHttpRequest();
  xhr.open('post','/upload', true);
  xhr.setRequestHeader("Content-Type", "application/pdf");                                
  xhr.send(blob);
  </code></pre>
  
  <p>I would like to save as pdf on the server running Node with express. I have come up with the following code using express and body-parser package:</p>
  
  <pre><code>const bodyParser = require('body-parser');
  
  app.use(bodyParser.urlencoded({ limit: '1gb', extended: false }));
  app.use(bodyParser.raw({ limit: '1gb', type: 'application/pdf' }));
  
  app.post('/upload', function(req, res){
     console.log(req.body);      
  }
  </code></pre>
  
  <p>req.body is a Buffer,  Uint8Array[653120]:</p>
  
  <p></p>
  
  <p>I need help converting it back to pdf before saving in on the server. Any help would be appreciated. Thanks.</p>