fn

encodeBinary

tested

Returns 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

ParameterTypeDescription
datareadonly number[]
eclQrCodeEcc

Returns

QrCode
PropertyTypeDescription
sizenumberThe width and height of this QR Code, measured in modules, between 21 and 177 (inclusive).
masknumberThe index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).
modulesUint8ArrayThe modules of this QR Code (0 = light, 1 = dark). Flat row-major Uint8Array.
typesInt8ArrayData type of each module. Flat row-major Int8Array.
versionnumber
eccQrCodeEcc
getModule(x: number, y: number) => booleanReturns 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) => QrCodeDataTypeReturns 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[]