I am getting a type error while implementing code for file upload in Angular application. I am using angular 8 and typescript 3.5.3. Following is my code
Template
<input type="file" id="file" (change)="handleFileInput($event.target.files)">
And function in component class
handleFileInput(files: FileList): void {
files[0].arrayBuffer().then((value) => {
console.log(value);
});
}
While compiling I get this error:
error TS2339: Property 'arrayBuffer' does not exist on type 'File'.
Any idea how to get rid of this error?