Create qrCode with output base64 from javascript
base64, javascript, qr-code
Solution
Install the library qrcode https://www.npmjs.com/package/qrcode
Instalation command: npm i qrcode
Then use the next code:
const QRCode = require('qrcode');
let QRbase64 = await new Promise((resolve, reject) => {
QRCode.toDataURL('I love tacos!!', function (err, code) {
if (err) {
reject(reject);
return;
}
resolve(code);
});
});
console.log(QRbase64);
Problem
I want to create qr-code with output base64 string from javascript. I found http://davidshimjs.github.io/qrcodejs/ for generate qr-code. That I want is get base64 string from this awesome tools.