File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -223,7 +223,12 @@ app.whenReady().then(() => {
223223 return { success : false , cancelled : true }
224224 }
225225
226- await writeFile ( result . filePath ! , content , 'utf8' )
226+ // Handle both string and Uint8Array/Buffer content
227+ if ( typeof content === 'string' ) {
228+ await writeFile ( result . filePath ! , content , 'utf8' )
229+ } else {
230+ await writeFile ( result . filePath ! , Buffer . from ( content ) )
231+ }
227232 return { success : true , filePath : result . filePath }
228233 } catch ( error ) {
229234 console . error ( 'Save file error:' , error )
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ declare global {
1313 removeStreamListener : ( requestId : string ) => void
1414 }
1515 saveFile : ( options : {
16- content : string
16+ content : string | Uint8Array
1717 defaultPath : string
1818 filters ?: Array < { name : string ; extensions : string [ ] } >
1919 } ) => Promise < { success : boolean ; cancelled ?: boolean ; filePath ?: string ; error ?: string } >
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ const api = {
3838 } ,
3939 // 文件操作API
4040 saveFile : ( options : {
41- content : string
41+ content : string | Uint8Array
4242 defaultPath : string
4343 filters ?: Array < { name : string ; extensions : string [ ] } >
4444 } ) => ipcRenderer . invoke ( 'save-file' , options ) ,
You can’t perform that action at this time.
0 commit comments