Electron不支持ipc传递Blob,会提示无法序列化错误
解决方法:将Blob转换为Buffer再通过ipc传递
let reader = new FileReader()
reader.onload = function () {
if (reader.readyState == 2) {
let buffer = Buffer.from(reader.result);
ipcRenderer.send('nesarc_common_notify', { buffer: buffer });
console.log(`Saving ${JSON.stringify({ size: blob.size })}`)
}
}
reader.readAsArrayBuffer(blob)
源:(https://stackoverflow.com/questions/43562192/write-file-to-disk-from-blob-in-electron-application)