#IPC V2 newbie usage question

4 messages · Page 1 of 1 (latest)

keen niche
#

I try to get the transfer of large binary data working in Tauri v2

I have my async function like the example in github:

async fn give_me_150mb_file() -> Result<Response> { ....

Ok(Response::new(bitmap.as_rgba_bytes()))
}

The Problem is getting the data on the typescript side:

let page = await invoke<Response>("give_me_150mb_file");
let data = await page.body;

I get it working with

async fn give_me_150mb_file() -> Result<Vec<u8>> { ....

Ok(bitmap.as_rgba_bytes())
}

and on the web side:
let data = await invoke("give_me_150mb_file");

The problem is the speed, I have the same test with Flutter and the Flutter Rust bridge, the transfer is done there in ms, but with the above Vec<u8> it is seconds. My hope is to use the new V2 IPC with the Response Value. But I can't get the data from there. Anyone with an idea, how to get the data in typescript from the Reponse?

THX
Marcel

keen niche
#

Ok I solved it, let page = await invoke<ArrayBuffer>("give_me_150mb_file");
let data = new Uint8Array(page);

#

Same speed then Flutter, nice

steel viper
#

nice! where can I read more about the improved V2 ipc?