Node生成QRコードqrcode base 64

3797 ワード

  • qr-image
  • qrcode
  • var QRCode = require('qrcode')
    
    QRCode.toString('I am a pony!I am a pony!I am a pony!I am a pony!',{type: 'svg'}, function (err, url) {
      console.log(url)
      console.log('data:image/svg+xml;base64,' + Buffer(url).toString('base64'))
    })
    
    
    var qr = require('qr-image');
    
    var qr_svg = qr.imageSync('I love QR!', { type: 'svg' });
    console.log(qr_svg);
    console.log('-----------------');
    console.log(Buffer(qr_svg).toString('base64'));