I am writing an electron application and some times I need to save some text into a file.
I am using the dialog module to let the user choose where to save the file and hot to name the file. Here is the part of the code that handles the file creation:
var exportSettings = (event, settings) => {
//settings is a css string
console.log(settings)
dialog.showSaveDialog({
title: 'Export settings as theme',
filters: [{
name: 'UGSM theme(CSS)',
extensions: ['css']
}]
},(fileName) => {
console.log('callback scope');
console.log(fileName);
if (fileName) {
fs.writeFile(fileName, settings, (error) => {
console.log(error);
});
}
});
}
The file is being created after the user selects a directory and a file name.However it is created as read only and I would like it to be created as editable from everyone.Any ideas why this is happening?