I'm not sure what the best name for it would be, but would be nice to have convenience methods for the following common scenario:
// write
const data = ...
const buf = new SmartBuffer()
.writeUInt32LE(data.length)
.writeBuffer(data)
.toBuffer();
...
// read
const reader = SmartBuffer.from(buf);
const data = reader.readBuffer(reader.readUInt32LE());
This is useful when you're constructing complex messages with multiple buffers inside them.
I'm not sure what the best name for it would be, but would be nice to have convenience methods for the following common scenario:
This is useful when you're constructing complex messages with multiple buffers inside them.