Skip to content

Commit b013908

Browse files
save file
1 parent 3bb4352 commit b013908

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

utils/editors/editor/v2.0/editor-v2.0.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,16 @@
7474

7575

7676
console.log(window.electronAPI);
77+
var encoder = new TextEncoder();
7778

7879
window.electronAPI?.onOpenFile(async({path})=>{
7980
console.log('openfile',path);
8081
var buf = await window.electronAPI.readFile({path});
8182
console.log('buf',buf);
83+
var blob = new Blob([buf]);
84+
var txt = await blob.text();
85+
txt += '123';
86+
var buf = encoder.encode(txt);
8287
await window.electronAPI.writeFile({path,buf});
8388

8489
});

0 commit comments

Comments
 (0)