本文主要是介绍electron打包后主进程下载文件崩溃,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
electron+vue3写了一个小项目,实现了一个文件下载功能
存在的问题
打包后,应用下载文件崩溃
代码
// 渲染进程window.electron.ipcRenderer.invoke('save-file', {'path': r.filePath,'fileurl': previewUrl,}).then(response => {console.log('response --------------');console.log(response);})// 主进程
ipcMain.handle('save-file', (event, args) => {// process.crash()try {// 下载保存文件console.log('axios args.fileurl ------------');console.log(args.fileurl);return downloadFile(args.fileurl, args.path)} catch (error) {console.log('error ---------------------------')console.log(error)return 'save-file 出错了: \n' + error.toString()
这篇关于electron打包后主进程下载文件崩溃的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!