How to choose , read, save, delete or create a file with Electron Framework
Why Stack Overflow recommends it
Stack Overflow users link it when answering or asking how to open file dialogs and read or write files from an Electron app.
Recommended by 1 people across 1 different months, 2018 to 2022.
What it is
A short tutorial from the Our Code World channel showing how to pick, read, save, delete and create files in an Electron desktop app. It uses Electron's dialog module together with Node's fs module, and it accompanies a written article on the same site.
What people said
Recommends izle_r · 2022-12 · Stack Overflow · on “How to show a file explorer window in electron app, where the user can select a particular folder?”
Using electron dialogs , file explorer can be added in electron app . const fs = require("fs"); const {dialog} = window.require("electron").remote; dialog.showOpenDialogSync({ properties: [ 'openFile', 'openDirectory'] }) Some useful resources: dialog | Electron [LINK] How to choose , read, save, delete or create a file with Electron Framework - YouTube [this video]
Cites Chipe · 2018-09 · Stack Overflow · on “Electron reading file from file system”
** Edit, I believe this is an issue with the initial boilerplate I started with (one using parcel) and is missing some part causing this issue. This seems to work just fine with electron-quick-start boilerplate ** I have searched around and can't find a solution. There is a youtube video tutorial showing how to read from the file system: [this video] But I implement the same but get this error fs.readFile is not a function . I am doing this in a react electron app however. Here is how I am setting this up: const fs = require('fs'); const { dialog } = window.require('electron').remote; ... getFile() { dialog.showOpenDialog((fileNames) => { // fileNames is an array that contains all the selected if
Cites CaioGoncalves · 2020-04 · Stack Overflow · on “How to read a .txt file with ElectronJS?”
I'm currently with problems while trying to read a .txt file with ElectronJS. I've start the test using the electron-quick-start repository (running Electron v8.2.1), don't know if it's something with it. But let's get into it. my index.html: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline';" /> <title>Hello World!</title> </head> <body> <input type="button" id="btn-readfile" value="Select a file"> <script> const fs = require('fs') const { dialog } = require('electron').remote document.getElementById('btn-readfile').addEventListener('click', () => { dialog.showOpenDialog((fileNames) => { if (fileNames =