Open stevenxxiu opened 7 years ago
File is a Blob-like interface, so it already does inherit. This has been supported for a while: https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsArrayBuffer
What version of FF are you using? The following works for me:
http://jsbin.com/fanahoxami/edit?html,output
<script>
const reader = new FileReader();
const f = new Blob(['abc'], {type: 'text/plain'});
reader.onload = e => {
console.log(e.target.result);
};
reader.readAsArrayBuffer(f);
</script>
new FileReader().readAsArrayBuffer(file)
doesn't work, and will show the error:TypeError: Argument 1 of FileReader.readAsArrayBuffer does not implement interface Blob.
.A work-around is
new FileReader().readAsArrayBuffer(this.recorder.file.file_.blob_)
but I'm guessing this is incompatible with real filesystem implementations.It will work if
File
is made to inherit from theBlob
class.