Browse Source

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 years ago
parent
commit
486bd920f8
2 changed files with 7 additions and 1 deletions
  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