瀏覽代碼

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