npm install bcdbinary coded decimals
```
npm install bcd
- bcd.encode(num) — encode given number into a buffer with a minimalbcd.encode(num, length)
length that fits the result;
- — encode given number into a buffer withlength
a given . If length is more than needed, the result is alignedlength
at the right side of the buffer and the rest is filled with zeroes. If
is less then needed, the result is truncated from the left side;bcd.encode(num, buffer)
- — encode givento number into a given buffer.bcd.decode(buffer)` — decode given buffer into a number. If the buffer
The above rules regarding length are applied.
-
is not a valid BCD, this method throws.
MIT