presenton/app/ipc/read_file.ts
2025-05-12 02:02:50 +05:45

9 lines
No EOL
293 B
TypeScript

import { ipcMain } from "electron";
import fs from "fs";
import path from "path";
export function setupReadFile() {
ipcMain.handle("read-file", async (_, filePath: string) => {
const normalizedPath = path.normalize(filePath);
return fs.readFileSync(normalizedPath, 'utf-8');
});
}