qr code npm code example
Example 1: read qr code from image nodejs
var Jimp = require("jimp");
var fs = require('fs')
var qrCode = require('qrcode-reader');
var buffer = fs.readFileSync(__dirname + '/image.png');
Jimp.read(buffer, function(err, image) {
if (err) {
console.error(err);
}
let qrcode = new qrCode();
qrcode.callback = function(err, value) {
if (err) {
console.error(err);
}
console.log(value.result);
};
qrcode.decode(image.bitmap);
});
Example 2: qr code terminal npm
$ npm install qrcode-terminal