Understanding Node-red-contrib-buffer-parser input values

I use the Node-red-contrib-buffer-parser and it handles the data in de incoming array as 16 bit values. The offset is in 8 bits which I don't understand. And I also don't understand how this node determines if the incoming data is 8 or 16 bits per value in the array.

Can someone explain this to me?

Under the hood, it uses the node Buffer A Buffer is essentially a fancy byte array :- 8 bits === 1 byte.

image

The thing to remember is that under the hood, data is treated as a byte stream and therefore the offset is a byte index from the beginning of the byte stream from which to extract data. That makes it 100% universal and independent of the input data - it is ALWAYS a byte offset, the data is ALWAYS a byte stream.

  • If input data is an array, the data is treated as 16 bit.
    • This is for simple and direct support of many 16 bit PLCs and in particular Modbus data.
  • If input data is a buffer, the data is treated as 8 bit.
    • This is for everything else (like serial data streams etc)

image

However, dont forget, as stated before, this is somewhat irrelevant since all data is treated as a byte array when it comes to the offset

Okay, thank you! Now it's clear to me!