Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 7x 7x 7x 7x 7x 7x 7x 7x 7x 37x 37x 37x 37x 37x 2x 2x 2x 2x 2x 2x 185x 185x 285x 285x 185x | import { MODE_8BIT_BYTE } from './mode-bits.constants.js'
import { textToBytes } from '../utils/text-decode-encode.util.js'
/**
* Create QR code byte mode object
* @param {string} data - data of mode object
* @returns {import('./mode-bits.constants.js').ModeObject} created mode object
*/
export const Qr8BitByte = (data) => Object.freeze({
data,
mode: MODE_8BIT_BYTE,
length: data.length,
write: writeDataToBitBuffer.bind(null, textToBytes(data)),
})
/**
* Writes byte data to bit buffer that will be used to generate the QR code
* @param {Uint8Array} data - Qr8BitByte mode object data byte array
* @param {import("./../utils/qr-bit-buffer.js").QrBitBuffer} buffer - target bit buffer
*/
function writeDataToBitBuffer (data, buffer) {
for (const byte of data) {
buffer.put(byte, 8)
}
}
|