Skip to content

Support for binary QR codes #982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ferm10n
Copy link

@ferm10n ferm10n commented Mar 2, 2025

Exposes metadata from zxing that includes the byteSegments. This would close #734

From there, you could join all the byte segments like this:

const byteSegments = qrcodeResult.result.metadata?.get(ResultMetadataType.BYTE_SEGMENTS);
if (byteSegments) {
  const totalLength = byteSegments.reduce((prev, curr) => prev + curr.length, 0);
  const concatBytes = new Uint8Array(totalLength);
  let offset = 0;
  for (const byteSegment of byteSegments) {
    concatBytes.set(byteSegment, offset);
    offset += byteSegment.length;
  }
  return new TextDecoder().decode(concatBytes);
}

Exposes metadata from zxing that includes the `byteSegments`
mokalovesoulmate added a commit to mokalovesoulmate/html5-qrcode that referenced this pull request May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Do you support reading of QR-coded binary data into e.g., Uint8Array?
1 participant