|
@@ -5,6 +5,8 @@ const electron = require('electron')
|
|
|
const v8Util = process.atomBinding('v8_util')
|
|
|
const {ipcMain, isPromise, webContents} = electron
|
|
|
|
|
|
+const fs = require('fs')
|
|
|
+
|
|
|
const objectsRegistry = require('./objects-registry')
|
|
|
|
|
|
const hasProp = {}.hasOwnProperty
|
|
@@ -235,6 +237,13 @@ ipcMain.on('ELECTRON_BROWSER_REQUIRE', function (event, module) {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
+ipcMain.on('ELECTRON_BROWSER_READ_FILE', function (event, file) {
|
|
|
+ fs.readFile(file, (err, data) => {
|
|
|
+ if (err) event.returnValue = {err: err.message}
|
|
|
+ else event.returnValue = {data: data.toString()}
|
|
|
+ })
|
|
|
+})
|
|
|
+
|
|
|
ipcMain.on('ELECTRON_BROWSER_GET_BUILTIN', function (event, module) {
|
|
|
try {
|
|
|
event.returnValue = valueToMeta(event.sender, electron[module])
|