I am trying to create a simple folder uploader (client side). The minimum required functionality is to be able to select a folder/file(s) and show on the browser the information of all files. I have used a simple input element:
const ReadFolder = () => {
const onFileChange = (event: React.ChangeEvent<HTMLInputElement>) => console.log(event.target.files);
return (
<input
type='file'
directory
webkitdirectory
multiple
onChange={onFileChange}
/>
);
}
The onFileChange function just shows the info of received file list.
It works fine for small folders, but when I try to upload a git repository from my computer (which has a large nested folder hierarchy), the browser window becomes unresponsive for around 2 minutes before the onChange event is reported. Is there a way I can avoid this unresponsiveness? Can I push this processing to background (or to a web worker)?