/Blob.js

An HTML5 Blob implementation

Primary LanguageJavaScriptOtherNOASSERTION

Blob.js

Blob.js implements the W3C Blob, File, FileReader and a subset of URL interface in browsers that do not natively support it.

  • Adds the new reading methods
    • blob.text() A promise resolving into text
    • blob.arrayBuffer() A promise resolving to ArrayBuffer
    • blob.stream() returns a ReadableStream (Made of ReadableStream or new Response(blob).body
  • It monkey patches XMLHttpRequest.prototype.send to support sending blobs while making sure Content-Type is set in old IE that didn't send blob's type
  • It override existing File implementation if they are not constructable (Old Safari & IE mainly)
  • URL get unprefixed
  • URL.createObjectURL creates a base64 data url if it's a "fake" Blob

Notes

ArrayBuffer, Promise and the Stream api's are not added, We recommened you to include polyfills for those if you plan to use them. readAsArrayBuffer and arrayBuffer(): returns a regular array if typed arrays are not supported.

Supported browsers

Blob.js shares the same supported browsers as FileSaver.js.