Skip to content

Can files be handled with Tauri commands? #9566

Answered by FabianLars
ukihot asked this question in Q&A
Discussion options

You must be logged in to vote

std::fs::File has no javascript or json representation so using it as a command arugments can't work.
A similar problem on the other side: the javascript File also does not have a json representation so it can't be send directly. The only real solution here that i'm aware of is to send the file as plain binary.

The argument on the rust side would be Vec<u8> and on js ideally number[] but iirc the invoke api will convert Uint8arrays and arraybuffer to number[] for you (but it has to be number[] in the end for the ipc to work)

Replies: 1 comment 1 reply

Comment options

FabianLars
Apr 25, 2024
Maintainer Sponsor

You must be logged in to vote
1 reply
@ukihot
Comment options

Answer selected by ukihot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants