fn
encodeBinary
testedReturns a QR Code representing the given binary data at the given error correction level. This function always encodes using the binary segment mode, not any text mode. The maximum number of bytes allowed is 2953.
Signature
ts
export function encodeBinary(data: readonly number[], ecl: QrCodeEcc): QrCode{ ... }Parameters
| Parameter | Type | Description |
|---|---|---|
data | readonly number[] | — |
ecl | QrCodeEcc | — |
Returns
QrCode| Property | Type | Description |
|---|---|---|
size | number | The width and height of this QR Code, measured in modules, between 21 and 177 (inclusive). |
mask | number | The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive). |
modules | Uint8Array | The modules of this QR Code (0 = light, 1 = dark). Flat row-major Uint8Array. |
types | Int8Array | Data type of each module. Flat row-major Int8Array. |
version | number | — |
ecc | QrCodeEcc | — |
getModule | (x: number, y: number) => boolean | Returns the color of the module (pixel) at the given coordinates. false for light, true for dark. Out of bounds returns false (light). |
getType | (x: number, y: number) => QrCodeDataType | Returns the data type of the module at the given coordinates. |
drawFunctionPatterns | () => void | — |
drawFormatBits | (mask: number) => void | — |
drawVersion | () => void | — |
drawFinderPattern | (x: number, y: number) => void | — |
drawAlignmentPattern | (x: number, y: number) => void | — |
setFunctionModule | (x: number, y: number, isDark: number, type?: QrCodeDataType) => void | — |
addEccAndInterleave | (data: readonly number[]) => number[] | — |
drawCodewords | (data: readonly number[]) => void | — |
applyMask | (mask: number) => void | — |
getPenaltyScore | () => number | — |
getAlignmentPatternPositions | () => number[] | — |