JavaScript library used for packing and unpacking LFS InSim packets
npm install --save @makao.pl/lfs-pack
Pack
// packing 4 unsigned chars into buffer
const buffer = pack('CCCC', [10, 20, 30, 40]);
console.log(buffer); // <Buffer 0a 14 1e 28>
Unpack
// unpacking 4 unsigned chars from buffer
const values = unpack('CCCC', Buffer.alloc(4));
console.log(values); // [0, 0, 0, 0]