Skip to content

Commit

Permalink
Fix: writeBinaryFile to call the correct command (fix #1133) (#1136)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
zakpatterson committed Jan 6, 2021
1 parent 5810bae commit 486bd92
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changes/writeBinaryFile.md
@@ -0,0 +1,6 @@
---
"tauri.js": patch
"tauri": minor
---

Match writeBinaryFile command name between js and rust
2 changes: 1 addition & 1 deletion cli/tauri.js/api-src/fs.ts
Expand Up @@ -166,7 +166,7 @@ async function writeBinaryFile(
}

return await promisified({
cmd: 'writeFile',
cmd: 'writeBinaryFile',
path: file.path,
contents: arrayBufferToBase64(file.contents),
options
Expand Down

0 comments on commit 486bd92

Please sign in to comment.