I am trying to port over some existing code from python to javascript, and am unsure how to go about the following line.
var1, var2 = struct.unpack('<II', buf[:8])
It should be getting two ints from a buffer. The buffer starts in binary, but at this point it has been converted to bytes (ie. bytes(buf)).
Example Buffer:
<Buffer 35 8a 0a 24 16 ed ea 42 88 28 b1 20 b1 cf c9 a1 c9 cc 5c 0b 18 b0 70 3a 8c b8 83 ee d6 ca 55 bf f9 75 1c 94 46 8c 17 03 01 00 20 5a 17 be 43 ba 08 a6 ... >
Uint8Array?var buf = new Buffer(0);. It's a packet buffer using cap in nodejs.