Open external file with Electron

There are a couple api’s you may want to study up on and see which helps you. fs The fs module allows you to open files for reading and writing directly. var fs = require(‘fs’); fs.readFile(p, ‘utf8’, function (err, data) { if (err) return console.log(err); // data is the contents of the text file we … Read more

Warning: ‘sandbox’ is not in the list of known options, but still passed to Electron/Chromium

I removed the snap version and install the deb file which works for me sudo snap remove code Downlaod code_1.58.1-1626158276_amd64.deb (latest) file from https://code.visualstudio.com/download and install it with –fix-broken option cd ~/Downloads/ && sudo apt –fix-broken install ./code_1.58.1-1626158276_amd64.deb

How to add a right-click menu in Electron that has “Inspect Element” option like Chrome?

Electron has a built-in function called win.inspectElement(x, y). Including this function as an option in a right-click context menu is possible by creating an Electron Menu with a MenuItem. Call the following in the client (aka renderer process) Javascript: // Importing this adds a right-click menu with ‘Inspect Element’ option const remote = require(‘remote’) const … Read more

How can we send messages from the main process to renderer process in Electron

To send a message back to the renderer you would use: win.webContents.send(‘asynchronous-message’, {‘SAVED’: ‘File Saved’}); And receive it like this: ipcRenderer.on(‘asynchronous-message’, function (evt, message) { console.log(message); // Returns: {‘SAVED’: ‘File Saved’} }); Where asynchronous-message is simply the channel you’re sending it to. It can literally be anything. webContents.send Docs

bundling precompiled binary into electron app

Here’s another method, tested with Mac and Windows so far. Requires ‘app-root-dir’ package, doesn’t require adding anything manually to node_modules dir. Put your files under resources/$os/, where $os is either “mac”, “linux”, or “win”. The build process will copy files from those directories as per build target OS. Put extraFiles option in your build configs … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)