Render QR codes in a terminal
Can be installed with:
$ npm install qrcode-terminal
and used:
var qrcode = require('qrcode-terminal');
To display some data to the terminal just call:
qrcode.generate('This will be a QRCode, eh!');
The default error correction level is 'L', but you can set it to one of 'L', 'M', 'Q', 'H':
qrcode.generate('This will be a QRCode with error level Q!', {errorLevel: 'Q'});
A type number may be specified as an integer in the range 1..40 in order to set the data capacity, according to this reference table:
qrcode.generate('This will be a QRCode with data capacity type 7', {typeNumber: 7});
Instead of the default behavior, you can pass a callback to handle the output:
qrcode.generate('http://github.com', function (qrcode) {
console.log(qrcode);
});
If you want to render a smaller output, provide opts
with small
:
qrcode.generate('This will be a small QRCode, eh!', {small: true});
qrcode.generate('This will be a small QRCode, eh!', {small: true}, function (qrcode) {
console.log(qrcode)
});
$ npm install -g qrcode-terminal
$ qrcode-terminal --help
$ qrcode-terminal 'http://github.com'
$ echo 'http://github.com' | qrcode-terminal
- OS X
- Linux
- Windows
node-qrcode is a popular server-side QRCode generator that
renders to a canvas
object.
To setup the development envrionment run yarn install
To run tests run yarn test
Gord Tanner <[email protected]>
Micheal Brooks <[email protected]>
Ildar Sagdejev <[email protected]>