I use the conversion to the hexadecimal number buffer as follows
Buffer.from(number.toString(16), 'hex')
But, for number less that 16(15, 14 and so on) I get an empty buffer.
Example
const buf = Buffer.from((5).toString(16), 'hex');
console.log(buf); // <Buffer >
I use the conversion to the hexadecimal number buffer as follows
But, for number less that 16(15, 14 and so on) I get an empty buffer.
Example