2

I am developing an epub reader in js. My app works on chrome 35 and recent browsers but not the old ones (ex: safari 5). I got this error "can't find variable FileReader" which occurs when I attempt to read a Blob.

var reader = new FileReader();
reader.readAsArrayBuffer(blob);

I am searching for an alternative to FileReader. I tried to use FileAPI instead which provides a readAsArrayBuffer method too :

var reader = FileAPI;
reader.readAsArrayBuffer(blob, function(e) {
    console.debug(e);
});

but console.debug returns : Object {type: "error", target: Blob, result: undefined, error: "filreader_not_support_BinaryString"}

I found this polyfill : https://github.com/Jahdrien/FileReader but I avoid using jquery. Thanks for your help.

spacewoox
  • 21
  • 3
  • You have no choice but to try some sort of Flash-based fallback. The one you linked is no longer maintained anyway, and it recommends [this alternative](https://github.com/moxiecode/moxie). You really don't have a choice here. – Pointy Jul 04 '14 at 12:26
  • What kind of browser does support `Blob`s but not `FileReader`? – Bergi Jul 04 '14 at 14:52
  • @Bergi _"What kind of browser does support Blobs but not FileReader"_ See http://stackoverflow.com/questions/38193605/how-to-updoad-in-old-browsers-ex-safari-5-1-4 , http://stackoverflow.com/questions/38195855/how-to-create-an-arraybuffer-and-data-uri-from-blob-and-file-objects-without-fil – guest271314 Jul 10 '16 at 00:22
  • @Bergi See also http://stackoverflow.com/questions/38239361/where-is-blob-binary-data-stored – guest271314 Jul 10 '16 at 00:38

0 Answers0