I want to implement a custom serializer for my class so I can use it for networking. However, d.readValue
throws an error: "Unable to deserialize cloned data."
Error: Unable to deserialize cloned data.
at /home/runner/QuarrelsomeBurdensomeClick/index.js:7:15
const { Serializer, Deserializer } = require("v8");
let s = new Serializer();
s.writeValue("Abc");
s.writeValue("Def");
let d = new Deserializer(s.releaseBuffer());
console.log(d.readValue()); // Error here.
console.log(d.readValue());
Oddly, if one of the writeValue
calls is removed along with a readValue
, the code is run as expected.
How do I serialize multiple values without this error?