Consistent Overhead Byte Stuffing and packet framing implemented in Node.
npm install cobs``npm install cobs`
See
``
cobs.encode(buffer) => buffer
cobs.decode(buffer) => buffer
cobs.encodeStream()
cobs.decodeStream()
cobs.maxLength(buffer or number) => number // upper bound
Results:
```
cobs.encode(new Buffer([0x00])) => 0x01 0x01
cobs.encode(new Buffer([0x11 0x22 0x00 0x33])) => 0x03 0x11 0x22 0x02 0x33
cobs.encode(new Buffer([0x11 0x00 0x00 0x00])) => 0x02 0x11 0x01 0x01 0x01
cobs.encode(new Buffer([0x01 0x02 ... 0xFF])) => 0xFF 0x01 0x02 ... 0xFE 0x02 0xFF