If you only want to register the contents, you can write them to the main stdout process directly using Electron remote.process directly from Renderer, but if you want to send the contents to the main process, then IPC is probably the best way (you can also use files, sockets, etc.).
Here is a very quick example of how you can do all this from your main.js file (but I would suggest using a separate file for the Renderer code and requesting it using the preload option for the Windows browser, this is just for illustrative purposes).
var electron = require('electron'); var ipc = electron.ipcMain; var BrowserWindow = electron.BrowserWindow; var win = new BrowserWindow({ width: 800, height: 600, show: false }); win.webContents.on('dom-ready', () => { win.webContents.executeJavaScript(` require('electron').ipcRenderer.send('gpu', document.body.innerHTML); `); }); ipc.on('gpu', (_, gpu) => { console.log(gpu) }) win.loadURL('chrome://gpu');
source share