custom document backend implemented

This commit is contained in:
santa
2026-01-08 14:25:14 +01:00
parent f81c9bc4e8
commit ed5a86dce0
4 changed files with 117 additions and 33 deletions
+24 -1
View File
@@ -262,4 +262,27 @@ let q1 = {
{name:"abc", displayname:"ABC"},
{name:"qeg", displayname:"aqghegahu"}
]
}
}
//gibt Documentfiles an preload zurück
electron.ipcMain.handle('get-txt-files', () => {
const storagePath = `${mainDir}/storage/documentType`
return fs.readdirSync(storagePath)
.filter(f => f.endsWith('.txt'))
});
//speichern neuer document types
electron.ipcMain.handle('save-txt-file', (event, fileName, content) => {
const filePath = `${mainDir}/storage/documentType/${fileName}.txt`;
fs.writeFileSync(filePath, content, 'utf8');
return true;
});
//
electron.ipcMain.handle('read-txt-file', (event, fileName) => {
const filePath = `${mainDir}/storage/documentType/${fileName}`;
return fs.readFileSync(filePath, 'utf8');
});