Here is the code snippet
ipcMain.handle("open-dialog", async (event: Electron.IpcMainInvokeEvent) => {
let filePaths = await dialog.showOpenDialog({
properties: ["openDirectory", "openFile"],
});
if (filePaths.canceled) {
return "canceled";
}
let selectedPath = filePaths.filePaths[0];
shell.openPath(selectedPath).then(() => {
chokidar
.watch(selectedPath, { awaitWriteFinish: true })
.on("all", (event, path, stats) => {
console.log("event", event, "path", path, "stats", stats);
})
.on("error", (error) => {
console.error("Error happened", error);
});
});
});
I'm currently using chokidar to monitor file changes, but I'm unsure how to specifically detect file closure events. Can anyone provide guidance or examples on how to achieve this with chokidar or other Node.js libraries