title: ArrayBuffer to blob conversion
body: <p>I have a project where I need to display djvu schemas in browser.</p>
  
  <p>I found this old <a href="https://github.com/lebedkin/minidjvu.js" rel="noreferrer">library on Github</a> which, as far as I understood, converts djvu files to bmp and then puts them into canvas element. </p>
  
  <p>As I said, library is old(last commit was 5 years ago), so I need to make some corrections. Main problem is that lib uses obsolete BlobBuilder. </p>
  
  <p>Steps I made to solve this problem:</p>
  
  <ol>
  <li>Decompress this library via Chrome DevTools</li>
  <li>Initial error is at line 3774 <code>var c = "undefined" != typeof MozBlobBuilder ? MozBlobBuilder : "undefined" != typeof WebKitBlobBuilder ? WebKitBlobBuilder : console.log("warning: cannot build blobs")</code></li>
  <li>I commented out this line</li>
  <li>Next, I commented out line <code>c = new c;</code> and some of following lines too.</li>
  </ol>
  
  <p>So, now it looks this way(variable I is array buffer, and ololo1 and ololo2 are some kind of offset and limit)</p>
  
  <pre><code>var c = new Blob(new Uint8Array(new Uint8Array(I,ololo1,ololo2)))
                , b = b.createObjectURL(c)
                , c = document.getElementById(kb)
                , f = c.getContext("2d")
                , h = new Image
                , g = a[Ea &gt;&gt; 2]
                , i = a[Fa &gt;&gt; 2]
                , j = c.width
                , k = Math.round(i * j / g);
  
              h.onload = function()
              {
                  var a = g / j;
                  4 &lt; a &amp;&amp; (a = 4);
                  1 &gt; a &amp;&amp; (a = 1);
                  f.globalAlpha = 1;
  
                  for (N = 0; N &lt; a; N++)
                      f.drawImage(h, N, N, g - a + N, i - a + N, 0, 0, j, k),
                      f.globalAlpha *= 1 - 1 / a;
                  R(h.complete, "Image /bmp.bmp could not be decoded")
              }
              ;
              h.onerror = function(errorMsg, url, lineNumber, column, errorObj) {
                  console.log(errorMsg, url, lineNumber, column, errorObj);
                  console.log("Image /bmp.bmp could not be decoded!")
              }           
              ;
  </code></pre>
  
  <p>And now I stuck at error "Image /bmp.bmp could not be decoded!"(throwed in h.onerror handler).</p>
  
  <p>So, my question is: what I am doing wrong?</p>