A node.js wrapper for libqrencode, but instead of encoding data to image, it returns raw QR data in buffer, which allows you to do amazing things.
You may need to install libqrencode-dev (>= 3.2) before install this package.
# Ubuntu
sudo apt-get install libqrencode-dev
# OS X
brew install libqrencode
npm install --save qrencode-raw
var qr = require('qrencode-raw');
var res = qr.encode(data, level, version);
- data string | Buffer data to encode, cannot be empty
- level QRecLevel error correction level:
qr.ECLEVEL_L
Lowestqr.ECLEVEL_M
qr.ECLEVEL_Q
qr.ECLEVEL_H
Highest
- version int QR code version
0
auto1
~40
manually set
{
version: 1,
width: 21,
data: <SlowBuffer ...>
}
- version int qr code version
- width int qr code width/height
- data Buffer qr code actual data, each byte represent a dot,
width * height bytes in total.
You can use bitwise AND with flags on each byte to extract info for that dot:qr.DOT_BLACK
dot is black.qr.DOT_DATA_ECC
dot is part of data or ecc codeqr.DOT_FORMAT
dot is format infoqr.DOT_VERSION
dot is version infoqr.DOT_TIMING
dot is part of timing patternqr.DOT_ALIGN
dot is part of alignment patternqr.DOT_FINDER
dot is part of finder patternqr.DOT_NON_DATA
dot is non-data