wuhkuh / protocol

Protocol generator / parser for Node.JS
MIT License
3 stars 3 forks source link

HACK in parse.js #2

Open wuhkuh opened 7 years ago

wuhkuh commented 7 years ago

More specifically in this chunk of code:

const byteStart = Math.floor(offset / 8)
const byteEnd = Math.ceil((offset + bitLength) / 8)
const bits = '0x' + buffer.toString('hex', byteStart, byteEnd) // HACK

Is there a better solution? Can we avoid using strings altogether?