1let file = new File(['hello', ' ', 'world'], 'hello_world.txt', {type: 'text/plain'});
2//or let file = document.querySelector('input[type=file]').files[0];
3let reader = new FileReader();
4reader.onload = function(e) {
5 let blob = new Blob([new Uint8Array(e.target.result)], {type: file.type });
6 console.log(blob);
7};
8reader.readAsArrayBuffer(file);
9