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

Request: State clearly in documentation that source buffer is modified #20

Open hoegge opened 8 months ago

hoegge commented 8 months ago

It would be helpful to user to know, that this modifes the source buffer, when swapping, since the buffer might be sent to other nodes too, or shown in status node.

Steve-Mcl commented 8 months ago

While not documented, it was a conscious choice not to clone the incoming buffer before applying the swap (for speed reasons - the buffer might be VERY large).

It may be worth adding a "[ ] clone" option instead to make it clearer? (How many people actually read the help?)

Will think it over.

PS, pull requests would be happily accepted.

hoegge commented 8 months ago

Understand, and I read up a bit on the passing by reference usage in Node-RED. Seems like most modules by standard clones the output, but if several nodes use same output they get the same reference. And makes a lot of sense to pass buffers as reference. I'll try to see if I can make a contribution, where this is an option, although I'm no Node-RED developer (yet)

PS: I read documentation, especially since it is otherwise hard to know how modules work. In general Node-RED packages are not super well documented, but your buffer packages has great docs.