Not sure how to describe it better than an example:
var data = Buffer.alloc(2);
data.writeUInt8(0xFF, 0);
data.writeUInt8(0x80, 1);
console.log(data.toString('exampleSomething'));
// something like what I would want it to print:
// "11111111 10000000"
I just want to have a string using 0s and 1s for each byte. Should I just do this manually (parse as a number then .toString(2) each byte) or is there a better way?
Example of "manually":
var outString = "";
data.forEach(e => {
outString += e.toString(2).padStart(8, "0") + " ";
});
console.log(outString);