I'm trying to convert a File into a Blob without using FileReader. I can't use FileReader because the latest version of Typescript (which I must use) doesn't accept a File as the parameter to fileReader.readAsArrayBuffer().
Using FileReader I can do it as follows:
var reader = new FileReader();
reader.onloadend = function(e) {
new Blob([ this.result ], { type: "image/jpeg" } );
};
reader.readAsArrayBuffer(file);
How can I achieve the same result without FileReader?
Fileis a subclass ofBlob, so you shouldn't even need to useFileReader, it just already is aBlob. You could always cast to ananythough if Typescript has issues with it.