Files
IPSExtractor/services/desktop_app/electron/preload.cjs
T

13 lines
763 B
JavaScript

const { contextBridge, ipcRenderer } = require("electron");
contextBridge.exposeInMainWorld("desktopApi", {
getRuntimeConfig: () => ipcRenderer.invoke("runtime:config"),
selectDirectory: () => ipcRenderer.invoke("dialog:select-directory"),
saveCsvDialog: (defaultPath) => ipcRenderer.invoke("dialog:save-csv", defaultPath),
writeTextFile: (filePath, content) => ipcRenderer.invoke("file:write-text", filePath, content),
findFirstDocument: (rootPath, keywords) => ipcRenderer.invoke("fs:first-document", rootPath, keywords),
indexFolder: (rootPath, structureMode, docTypes, keywords) =>
ipcRenderer.invoke("fs:index-folder", rootPath, structureMode, docTypes, keywords),
readFile: (filePath) => ipcRenderer.invoke("fs:read-file", filePath),
});