9 lines
No EOL
293 B
TypeScript
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');
|
|
});
|
|
} |