Bincode Javascript

#1

Hi,

Anyone have a working example on how to do:

https://docs.rs/bincode/0.8.1/bincode/
I literally need the same thing than the serialization here but in JS.

let encoded: Vec<u8>        = serialize(&target, limit).unwrap();

After that, i’ll send it through websockets and receiver (Rust server) will deserialize it (with bincode)

Thanks guys! :slight_smile:

#2

When I checked a couple months ago, there didn’t appear to be any implementations of bincode in other languages (it’s not an existing standard, but a Rust thing from Servo). Consider using serde_json to pass data to JavaScript.

#3

I believe you can use wasm-bindgen and process the array buffer of the response result from a fetch request.