JSFiddle - React, Tailwind, and code Playground
by godhong
JavaScript
if ($("#OCC_mod").valid()) {
file_path = require('path').dirname(require.main.filename)
dialog.showSaveDialog({
defaultPath: file_path
}, function(fileName) {
if (fileName === undefined) {
console.log("You didn't save the file");
return;
}
// fileName is a string that contains the path and filename created in the save file dialog.
fs.writeFile(fileName, csv_content_final, function(err) {
if (err) {
alert("An error ocurred creating the file " + err.message)
}
alert("The file has been succesfully saved");