How to use the qrcode.toDataURL function in qrcode

To help you get started, we’ve selected a few qrcode examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mymonero / mymonero-app-js / local_modules / RequestFunds / Models / FundsRequest.js View on Github external
_new_qrCode_imgDataURIString(fn)
	{
		const self = this
		const fundsRequestURI = self._assumingBootedOrEquivalent__Lazy_URI__addressAsFirstPathComponent() // NOTE: creating QR code with URI w/o "//" - wider scanning support in ecosystem
		// ^- since we're not booted yet but we're only calling this when we know we have all the info
		const options = { errorCorrectionLevel: 'Q' } // Q: quartile: 25%
		QRCode.toDataURL(
			fundsRequestURI, 
			options,
			function(err, imgDataURIString)
			{
				if (err) {
					console.error("Error generating QR code:", err)
				}
				fn(err, imgDataURIString)
			}
		)
	}
github ly525 / luban-h5 / front-end / h5 / src / views / work-manager / templates.vue View on Github external
genQRCodeUrl (work) {
      const url = `/works/preview/${work.id}`
      QRCode.toDataURL(url, (err, url) => {
        if (err) console.log(err)
        this.qrcodeUrl = url
      })
    }
  },
github austintgriffith / eth.build / src / nodes / Display / QR.js View on Github external
DisplayQR.prototype.onExecute = function() {
    if (this.inputs[0] && this.value != this.getInputData(0)) {
        this.value = this.getInputData(0);
        if(this.value){
            //console.log("QR VALUE ",this.value)
            QRCode.toDataURL(this.value, {color: {
              dark: '#EEE',
              light: '#111',
              width: this.size[0],
              height: this.size[1],
            }} , (err, url) => {
                var image = new Image();
                image.onload = ()=>{
                  this.qr = image
                  //console.log("QR SET",this.qr)
                };
                if(this.value){
                  image.src = url;
                  //console.log("SRC",image.src)
                }
            })
        }
github webclipper / web-clipper / src / common / backend / services / yuque / complete / quickResponseCode.tsx View on Github external
loadQRCode = () => {
    const { documentId, accessToken, repositoryId } = this.props;
    const { includeToken } = this.state;

    let url = `${quickResponseCodeHost}/index?repo_id=${repositoryId}&id=${documentId}`;
    if (includeToken) {
      url += `&token=${accessToken}`;
    }
    QRCode.toDataURL(
      url,
      { errorCorrectionLevel: 'H' },
      (err: Error, quickResponseCodeData: string) => {
        if (err) {
          console.log(err);
        }
        this.setState({
          quickResponseCodeData,
        });
      }
    );
  };
github bigearth / bitbox-cli / index.js View on Github external
QRCode.toDataURL(privateKeyWIF, (err, privateKeyWIFQR) => {
      QRCode.toDataURL(address, (err, addressQR) => {
        fs.writeFileSync( `./paper-wallet.html`, `
          <div>
            <h2>Private Key WIF</h2>
            <p>${privateKeyWIF}</p>
            <p><img src="${privateKeyWIFQR}"></p>
          </div>
          <div>
            <h2>Public address</h2>
            <p>${address}</p>
            <p><img src="${addressQR}"></p>
          </div>
          <div>
            <p>Mnemonic: ${mnemonic}</p>
            <p>HD Path: m/44'/145'/0'/0/0</p>
            <p>Encoding:  ${options.encoding}</p>
            <p>Language:  ${options.language}</p></div>
github chvin / react-tetris / src / components / guide / index.js View on Github external
componentWillMount() {
    if (this.state.isMobile) {
      return;
    }
    QRCode.toDataURL(location.href, { margin: 1 })
        .then(dataUrl => this.setState({ QRCode: dataUrl }));
  }
  shouldComponentUpdate(state) {
github ElementsProject / lightning-charge / src / checkout.js View on Github external
app.get('/checkout/:invoice', wrap(async (req, res) => {
    const opt = req.invoice.metadata && req.invoice.metadata.checkout || {}

    if (req.invoice.status == 'paid' && opt.redirect_url)
      return res.redirect(opt.redirect_url)

    if (req.invoice.status == 'unpaid')
      res.locals.qr = await qrcode.toDataURL(`lightning:${req.invoice.payreq}`.toUpperCase(), { margin: 1 })

    res.render('checkout', req.invoice)
  }))
github anotherleon / Test-Field / 11.koa+vue+ Element UI / server / src / genCodeImg.js View on Github external
return new Promise((resolve, reject) => {
    const opts = {
      errorCorrectionLevel: 'H',
      type: 'png',
      scale: 30
    }
    const url = `http://ysj.tcfellow.com/card?code=${code}`
    qrcode.toDataURL(url, opts, function (err, url) {
      if (err) reject(err)
      resolve(url)
    })
  })
}
github webinos / Webinos-Platform / webinos / pzh / lib / pzh_qrcode.js View on Github external
function create(url, code, cb) {
  "use strict";
  try { 
    var QRCode = require("qrcode");
    var urlCode = "" + url + " " + code;
    QRCode.toDataURL(urlCode, function(err,url) {
      cb(err, url);
    });
  } catch (err) {
    cb(err, "<img src="\&quot;http://www.yooter.com/images/pagenotfound.jpg\&quot;">");
  }
}
github abrasive / mygov-totp-enroll / main.js View on Github external
function makeQR(secret) {
    secret32 = base32.stringify(base64.parse(secret))
    secret32 = secret32.replace(/=+$/, "")
    totp_uri = 'otpauth://totp/myGov?secret=' + secret32 + '&amp;algorithm=SHA512'

    qrcode.toDataURL(totp_uri)
        .then(url =&gt; {
            setStatus("Enroll this secret in your TOTP client and enter the current code");
            setDetail(totp_uri + '<p><img src="' + url + '">');
            showCodeForm(true);
        })
        .catch(err =&gt; {
            setError("QR encoding error", err);
        })
}
</p>