2021-03-22 20:11:03 +00:00
|
|
|
const { contextBridge, ipcRenderer } = require('electron');
|
|
|
|
|
|
|
|
contextBridge.exposeInMainWorld('api', {
|
2023-10-31 21:29:40 +00:00
|
|
|
// This is not safe, do not copy this code into your app
|
|
|
|
invoke: (...args) => ipcRenderer.invoke(...args),
|
2021-03-22 20:11:03 +00:00
|
|
|
run: async () => {
|
2023-06-15 14:42:27 +00:00
|
|
|
const { promises: fs } = require('node:fs');
|
2021-03-22 20:11:03 +00:00
|
|
|
for (let i = 0; i < 10; i++) {
|
|
|
|
const list = await fs.readdir('.', { withFileTypes: true });
|
|
|
|
for (const file of list) {
|
|
|
|
if (file.isFile()) {
|
|
|
|
await fs.readFile(file.name, 'utf-8');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|