'ReferenceError: FileReader is not defined
I'm using in my index.js file this:
const reader = new FileReader();
I have this index.js file imported to my index.html
<script src="index.js"></script>
If I open the index.html file in browser, everything works fine.
However, if I try to use node index.js or nodemon index.js command, I get an error.
ReferenceError: FileReader is not defined
I can see in the vscode IDE that Filereader is from 'lib.dom.d.ts' and if I type to chrome inspect console 'FileReader' I can see that it exists. It seems to be bundled with chrome.
Is there a way I could bundle this file to index.js so that I can run node index.js or nodemon index.js? Or am I approaching this the wrong way? Should I use some other package instead of FileReader? The purpose is to use the package in the browser to read a file.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
