mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-10-10 22:38:44 +02:00
fix(fs): truncate the file when writeFile writes a stream (#3629)
In plugins/fs/guest-js/index.ts writeFile, the stream path opened the
file with {write, create} but no truncate, unlike the buffer path which
truncates unless `append` is set (commands.rs write_file_inner), so
shorter content left stale trailing bytes.
The stream path now passes `truncate: !options?.append`. api-iife.js
regenerated. E2E spec covers overwrite and append with a stream.
This commit is contained in:
1 parent
5e6c023a79
commit
dcc8cb032b
4 files changed
+43
-2
No files matched your search
@@ -1193,7 +1193,9 @@ async function writeFile(
|
||||
read: false,
|
||||
create: true,
|
||||
write: true,
|
||||
...options
|
||||
...options,
|
||||
// overwrite the previous contents, like when writing a buffer
|
||||
truncate: !options?.append
|
||||
})
|
||||
const reader = data.getReader()
|
||||
|
||||
|
||||
Reference in new issue
Block a user