Generate QR codes. Based on Kazuhiko Arase's implementation.
$ component install matthewmueller/qr-code
var qr = require('qr-code');
var dataURI = qr('Hello!');
var img = new Image();
img.src = dataURI;
document.body.appendChild(img);
QR(text, options)
Create a QR code containing the given text
. The result is a dataURI that you can place in an image or background. QR also takes some options
including:
- type: QR code type. Changes the amount of information you can store in the QR code (ie. density). Defaults to
4
. - level: Backup level. See QR code error correction. Defaults to
M
- size: Size of the QR code. Defaults to
4
. - margin: Whitespace around the outside of the image. Defaults to
0
.
size
should be based on pixels not some arbitrary number.
MIT