소스 검색

Fix: writeBinaryFile to call the correct command (fix #1133) (#1136)

* Fix writeBinaryFile to call the correct command

Fixes #1133

writeBinaryFile was reusing writeFile, which was happily saving
base64 encoded strings to the fs. This instead uses the correct
WriteBinaryFile command, which base64 decodes.

However why are we encoding and then decoding, why can we not just
send a raw byte array to be saved as a file? This is left for a later
PR.

* Shorten changelog line per review
Zak Patterson 4 년 전
부모
커밋
486bd920f8
2개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 0
      .changes/writeBinaryFile.md
  2. 1 1
      cli/tauri.js/api-src/fs.ts

+ 6 - 0
.changes/writeBinaryFile.md

@@ -0,0 +1,6 @@
+---
+"tauri.js": patch
+"tauri": minor
+---
+
+Match writeBinaryFile command name between js and rust

+ 1 - 1
cli/tauri.js/api-src/fs.ts

@@ -166,7 +166,7 @@ async function writeBinaryFile(
   }
 
   return await promisified({
-    cmd: 'writeFile',
+    cmd: 'writeBinaryFile',
     path: file.path,
     contents: arrayBufferToBase64(file.contents),
     options