How to unpack an .asar file?

From the asar documentation (the use of npx here is to avoid to install the asar tool globally with npm install -g asar) Extract the whole archive: npx asar extract app.asar <destfolder> Extract a particular file: npx asar extract-file app.asar main.js

Atom Electron – Close the window with javascript

You must access the BrowserWindow object created by your main process and call the minimize, maximize, and close methods on that. You can access this using the remote module. Here is an example of binding all three buttons: const remote = require(‘electron’).remote; document.getElementById(“min-btn”).addEventListener(“click”, function (e) { var window = remote.getCurrentWindow(); window.minimize(); }); document.getElementById(“max-btn”).addEventListener(“click”, function (e) … Read more

How to close electron app via javascript?

you can use const remote = require(‘electron’).remote let w = remote.getCurrentWindow() w.close() to close your app. if you are using jQuery const remote = require(‘electron’).remote $(‘#close-btn’).on(‘click’, e => { remote.getCurrentWindow().close() }) if you are using Vue.js <template> <button @click=”close”><i class=”fa fa-cube” aria-hidden=”true”></i>&nbsp; Close application</button> </template> <script> const remote = require(‘electron’).remote export default{ data(){ return { … Read more

Saving files locally with electron

If you are targeting multiple platforms, I answered a similar question here. Basically app.getPath(name), app.setPath(name, path), and app.getAppPath() are very useful in saving files to the the right place regardless of the OS. You may also want to check out these Nodejs packages which help simplify saving files directly to the host machine… fs-jetpack graceful-fs … Read more