Answers for "electron save as dialog"

0

electron save as dialog

// Electron Save As Dialog
// Syntax: dialog.showSaveDialog([browserWindow, ]options)

const {remote} = require('electron');
var dialog = remote.dialog;

var browserWindow = remote.getCurrentWindow();
var options = {
    title: "Save new file as...",
    defaultPath : "/path/to/new_file.jsx",
    filters: [
        {name: 'Custom File Type', extensions: ['jsx']}
    ]
}

let saveDialog = dialog.showSaveDialog(browserWindow, options);
saveDialog.then(function(saveTo) {
    console.log(saveTo.filePath);
  //>> /path/to/new_file.jsx
})
Posted by: Guest on July-07-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language