Electron escreva para CSV

ipcMain.on("write-csv-data", async (event, filePath, data) => {
    const csvWriter = createCsvWriter({
      path: `${filePath}`, // Don't ask why. This is how i got it to work.
      header: [
        { id: "name", title: "First Name" },
        { id: "timezone", title: "Timezone" },
      ],
    });
    csvWriter
      .writeRecords(data)
      .then(() => {
        console.log(`...Done (${filePath})`);
      })
      .catch((err) => {
        console.log(err);
      });
});
Pixeloid