Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
MainIPCStream.prototype._write = function (data, enc, next) {
if (typeof data === 'string') {
data = JSON.stringify(data)
}
if (Buffer.isBuffer(data)) {
data = JSON.stringify(data, null, bufferJson.replacer)
}
if (!this.browserWindow) return console.warn('MainIPCStream: trying to write when no browserWindow is set.')
this.browserWindow.webContents.send(this.channel, data)
next()
}
RendIPCStream.prototype._write = function (data, enc, next) {
if (typeof data === 'string') {
data = JSON.stringify(data)
}
if (Buffer.isBuffer(data)) {
data = JSON.stringify(data, null, bufferJson.replacer)
}
ipcRenderer.send(this.channel, data)
next()
}