showing results for - "electron save as dialog"
Dido
12 Jan 2018
1// Electron Save As Dialog
2// Syntax: dialog.showSaveDialog([browserWindow, ]options)
3
4const {remote} = require('electron');
5var dialog = remote.dialog;
6
7var browserWindow = remote.getCurrentWindow();
8var options = {
9    title: "Save new file as...",
10    defaultPath : "/path/to/new_file.jsx",
11    filters: [
12        {name: 'Custom File Type', extensions: ['jsx']}
13    ]
14}
15
16let saveDialog = dialog.showSaveDialog(browserWindow, options);
17saveDialog.then(function(saveTo) {
18    console.log(saveTo.filePath);
19  //>> /path/to/new_file.jsx
20})