@webreflection/qrcode

0.2.4 • Public • Published

@webreflection/qrcode

Social Media Photo by Risto Kokkonen on Unsplash

Based on @zxing/library, this module exports a scan({ facingMode = 'environment' }) or write(text[, options]) async utilities that helps users finding a QR Code and grab its result as data, or show one on any page.

Live Demo

The facingMode property is described on MDN.

// pre-bundled file @ https://cdn.jsdelivr.net/npm/@webreflection/qrcode/dist.js
import { scan, write } from '@webreflection/qrcode';

const result = await scan();

// result.text, result.bytes, result.format
console.log(result);

// regenerate the QR code (SVG)
document.body.appendChild(
  await write(result.text)
  // pass { canvas } element to have
  // an image drawn in it instead
);

The LICENSE is the same used in @zxing/library as I haven't added/done much else in here, just re-packaged and added minimalistic logic to help scanning.

Package Sidebar

Install

npm i @webreflection/qrcode

Weekly Downloads

23

Version

0.2.4

License

Apache-2.0

Unpacked Size

411 kB

Total Files

6

Last publish

Collaborators

  • webreflection