title: Convert Blob data to Raw buffer in javascript or node
body: <p>I am using a plugin <a href="https://github.com/MrRio/jsPDF" rel="noreferrer">jsPDF</a> which generates PDF and saves it to local file system. Now in jsPDF.js, there is some piece of code which generates pdf data in blob format as:-</p>
  
  <pre><code>var blob = new Blob([array], {type: "application/pdf"});
  </code></pre>
  
  <p>and further saves the blob data to local file system. Now instead of saving I need to print the PDF using plugin <a href="https://github.com/tojocky/node-printer" rel="noreferrer">node-printer</a>.</p>
  
  <p>Here is some sample code to do so</p>
  
  <pre><code>var fs = require('fs'),
  var dataToPrinter;
  
  fs.readFile('/home/ubuntu/test.pdf', function(err, data){
      dataToPrinter = data;
  }
  
  var printer = require("../lib");
  printer.printDirect({
      data: dataToPrinter,
      printer:'Deskjet_3540',
      type: 'PDF',
      success: function(id) {
          console.log('printed with id ' + id);
      },
      error: function(err) {
          console.error('error on printing: ' + err);
      }
  })
  </code></pre>
  
  <p>The <code>fs.readFile()</code> reads the PDF file and generates data in raw buffer format.</p>
  
  <p><strong>Now what I want is to convert the 'Blob' data into 'raw buffer' so that I can print the PDF.</strong></p>