How to access Buffer in renderer that was allocated in main?


#1

In the main process I have a large Buffer that was allocated from a c++ node addon. How can I pass this buffer over to the electron renderer thread so that I can access the data without having to copy/recreate it?


#2

There are two modules in Electron, ipcMain and ipcRenderer, that allow for emitting events between processes.


#3

say I allocate a 1GB buffer (meshData) in the Main thread and I want to pass this data down to the renderer thread. Wouldn’t using _mainWindow.webContents.send( ‘sendGeometry’, meshData ); cause the 1GB buffer to be duplicated when transmitted thus the renderer would have a copy of the 1GB buffer? I want to have access to the actual data, not a copy of the data in the renderer.