The W3 announced that they intend to deprecate the BlobBuilder API in preference for the new Blob API.
If I am already using BlobBuilder in a JavaScript app, how can I convert to using this new Blob API? The old WebKitBlobBuilder is still available in the latest WebKit (and Chrome Canary), but it will soon be removed. Before you could write something like this:
var bb = new BlobBuilder();
bb.append(arrayBuffer);
var blob = bb.getBlob(mimeString);
How could this be rewritten to use the new Blob constructor? Thank you.
Passing an ArrayBuffer to the Blob constructor appears to be deprecated, so:
var dataView = new DataView(arrayBuffer);
var blob = new Blob([dataView], { type: mimeString });
From what the specs says it should be as simple as this. Just check the examples of the page you posted.
var blob = new Blob(arrayBuffer);
[Constructor, Constructor((ArrayBuffer or Blob or DOMString)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With