Skip to content

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