How to read a local file in Javascript (Running from an Electron App)

I have been searching for over an hour or so, and I cant find an answer to my question. Is there a way to get the text from a local file, using just a plain old file URL?

I have found numerous ways to read a file via file input HTML tag, but I have had an incredible pain, finding a code example that can find a file, on my PC, using just plain old JS.

The code will be inside an electron application.

I need code examples. Something like this:

readFile("file:\\\\C:\path\to\file.txt","text/plain");

readFile(url,mimetype){
 ....
}


Read more here: https://stackoverflow.com/questions/66266205/how-to-read-a-local-file-in-javascript-running-from-an-electron-app

Content Attribution

This content was originally published by X Builder at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: