title: How to replace the deprecated BlobBuilder with the new Blob constructor?
body: <p>Since Blobbuilder is deprecated and I have recently decided to use a new facial recognition API I am having a hard time switching over to just "blob".</p>
  
  <pre><code>function dataURItoBlob(dataURI, callback) {
          // convert base64 to raw binary data held in a string
          // doesn't handle URLEncoded DataURIs
  
          var byteString;
          if (dataURI.split(',')[0].indexOf('base64') &gt;= 0) {
              byteString = atob(dataURI.split(',')[1]);
          } else {
              byteString = unescape(dataURI.split(',')[1]);
          }
  
          // separate out the mime component
          var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
  
          // write the bytes of the string to an ArrayBuffer
          var ab = new ArrayBuffer(byteString.length);
          var ia = new Uint8Array(ab);
          for (var i = 0; i &lt; byteString.length; i++) {
              ia[i] = byteString.charCodeAt(i);
          }
  
          // write the ArrayBuffer to a blob, and you're done
          var BlobBuilder = window.WebKitBlobBuilder || window.MozBlobBuilder;
          var bb = new BlobBuilder();
          bb.append(ab);
          return bb.getBlob(mimeString);
  }
  </code></pre>
  
  <p>I tried switching it over to just:</p>
  
  <pre><code>        // write the ArrayBuffer to a blob, and you're done
          var Blob = window.URL || window.webkitURL;
          var bb = new Blob();
  
          /*var link = document.createElement('link');
          link.rel = 'stylesheet';
          link.href = window.URL.createObjectURL(blob);
          document.body.appendChild(link);*/
  
          /*var BlobBuilder = window.WebKitBlobBuilder || window.MozBlobBuilder;
          var bb = new BlobBuilder();
          bb.append(ab);*/
          return bb.getBlob(mimeString);
  }
  </code></pre>
  
  <p>But i keep getting <code>Uncaught TypeError: Object #&lt;URL&gt; has no method 'getBlob'</code> in the console. Not sure what I am missing. If i try to use <code>bb.append(ab);</code> I get <code>Uncaught TypeError: Object #&lt;Blob&gt; has no method 'append'</code> in the console.</p>