Electron app restarts automatically after calling fs.writeFile method

118 Views Asked by At

I have a problem with my electron app. I'm writing an app that creates CV's using data that user entered to it. I don't know how to prevent automatically restart after calling a fs.writeFile method. It causes any errors or anything like that, just restart. I installed all fs files using terminal and also included this line of code:

const fs = require("fs");

That's the function which generates the problem:

const generatePDF = function () {

  fs.writeFile('database.json', JSON.stringify(userData), (err) => {

    if (err) console.log(err);
})};

I've tried to look for some answers in google but I didn't find anything, thanks for all your help, I'm just a beginner.

0

There are 0 best solutions below