How does nodejs socket send protobuf data?

1. In the process of electron development, socket communication and google protobuf codec of net module are used. The data returned after encoding is uint8array data, which is an object, and new.socket.write method. Only one string or buffer is allowed.

but after the front end is packaged through the webpack tool, the buffer object created or transformed by node"s buffer is still displayed as a uint8Array object at the front end. So the socket.write method is wrong.
but if you run my js file directly in node, the output is the Buffer object. Could you tell me how to deal with this problem? -sharp-sharp-sharp problem description

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)
the following pictures are the same variables output in node and browser, but the results are inconsistent. My application is developed by electron, but the code is packaged and run by webpack, not based on the node runtime environment. I haven"t straightened out the relationship between electron and node so far

clipboard.png

clipboard.png

what result do you expect? What is the error message actually seen?

Menu