fix: 图片/文件读取改用 base64,修复 atob Latin1 错误
- 主进程新增 fs:readFileBase64 IPC,读 Buffer 直接返回 base64 - 图片读取从 atob 转换改为直接使用 readFileBase64 - .metona 备份导入同理修复 - 根因:fs:readFile 用 utf-8 编码读取二进制文件,UTF-8 多字节序列超出 Latin1 范围导致 atob 失败
This commit is contained in:
@@ -13,6 +13,7 @@ contextBridge.exposeInMainWorld('metonaDesktop', {
|
||||
},
|
||||
fs: {
|
||||
readFile: (filePath: string) => ipcRenderer.invoke('fs:readFile', filePath),
|
||||
readFileBase64: (filePath: string) => ipcRenderer.invoke('fs:readFileBase64', filePath),
|
||||
writeFile: (filePath: string, content: string, encoding?: string) => ipcRenderer.invoke('fs:writeFile', filePath, content, encoding)
|
||||
},
|
||||
tool: {
|
||||
|
||||
Reference in New Issue
Block a user