Read and write packed binary strings, bit-by-bit, in JavaScript