tauri: [bug] writeBinaryFile cant write file with size more, than ~50 mb
Describe the bug
I’m trying to write file with 70 mb size and it keeps crashing with “Out of Memory” error (or just crash) https://youtu.be/ygcYvTq4xBI It shouldn’t close
Reproduction
- Get >=50mb file in Uint8Array
- Try to write it
Expected behavior
New file
Platform and versions
[✔] Environment
- OS: Windows 10.0.22621 X64
✔ WebView2: 112.0.1722.68
✔ MSVC: Visual Studio Community 2022
✔ rustc: 1.69.0 (84c898d65 2023-04-16)
✔ Cargo: 1.69.0 (6e9a83356 2023-04-12)
✔ rustup: 1.25.2 (17db695f1 2023-02-01)
✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
- node: 18.16.0
- npm: 9.5.1
[-] Packages
- tauri [RUST]: 1.2.4
- tauri-build [RUST]: 1.2.1
- wry [RUST]: 0.23.4
- tao [RUST]: 0.15.8
- @tauri-apps/api [NPM]: not installed!
- @tauri-apps/cli [NPM]: 1.3.0
[-] App
- build-type: bundle
- CSP: unset
- distDir: ../src
- devPath: ../src
Stack trace
No response
Additional context
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 18
i used salvo to enable web services, this is my simple code to transfer file:
but now i think use tauriv2 is a good idea, more detail can see https://github.com/tauri-apps/tauri/issues/9322
This is a limitations in current IPC, I encountered same problem and talked with the devs on discord. You need to split into smaller batch, and write incrementally.
I ended up doing this:
following reference: https://github.com/tauri-apps/tauri/issues/585
Flow: Convert blob to array buffer -> JS ArrayBuffer -> Split to smaller chunk -> Rust append the buffer to a file string -> Repeat untill all chunk is writren