JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 81640
  • Score
    100M100P100Q158357F
  • License MIT

fork of lazarsoft's jsqrcode for node

Package Exports

  • qrcode-reader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (qrcode-reader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

JavaScript QRCode reader for HTML5 enabled browser.

This is a port of Lazarsoft’s qrcode reader

Build Status

Installation

npm install qrcode-reader

Usage

QrCode=require(‘qrcode-reader’);

Create a new instance of QrCode:

qr= new QrCode();

Set it's callback to a custom function

qr.callback= function(result){alert(result)}

Decode an image by it's URL or Data URI:

qr.decode(url or DataURL);

Decode an image by context.getImageData: Works with web workers.

var context = canvas.getContext("2d");
var data = context.getImageData(0, 0, width, height);

qr.decode(data);

Decode from canvas with "qr-canvas" ID:

qr.decode()

Building it yourself

If you want, you can build the script yourself.

First clone the repository, then from the directory of this repository, do :

npm install
gulp compile

You will have one jsfile called index.js that you can run from node.

You can then run the tests by running

npm test

Make it work in the browser

After building yourself the script index.js, you can do :

npm install --global browserify
browserify -o qrcode.js -s QrCode index.js

This way if you do in your HTML :

<script src="qrcode.js"></script>
you will have access to the global variable `QrCode`