Steve-Mcl / node-red-contrib-buffer-parser

A node-red node to convert values in a buffer, integer array or hex string into many different data type(s). Supports Big/Little Endian, BCD, byte swapping and much more.
MIT License
24 stars 8 forks source link

msg.originalPayload issue when input is a buffer #7

Open Steve-Mcl opened 3 years ago

Steve-Mcl commented 3 years ago

msg.originalPayload (when input is a buffer) is just a reference so if the data is byteswapped, originalBuffer is affected.

Consider cloning before processing.

Consider making the extra properties optional (to cleanup the msg)

albfan commented 1 year ago

Probably you can do all that in a function node, force a cloning for an internal structure will slow all execution to solve a particular use case