QR Scanner: JavaScript QR code detection library
Webcam and image QR detection with native API fallback.
Learn more about QR Scanner
QR Scanner is a JavaScript library that detects and decodes QR codes in web browsers. It processes video streams from webcams or analyzes single images, running the detection algorithm in a WebWorker to avoid blocking the main thread. The library automatically uses the browser's native BarcodeDetector API if supported, otherwise falls back to a JavaScript-based decoder. It supports both continuous video scanning and single-image analysis, with configuration options for optimizing detection on colored QR codes.
WebWorker-based processing
The scanning algorithm runs in a separate WebWorker thread, keeping the main UI thread responsive during detection operations.
Native API fallback pattern
Automatically uses the browser's native BarcodeDetector API when available, reducing the loaded code size to approximately 5.6 kB gzipped. Falls back to the JavaScript implementation for unsupported browsers.
Dual-file architecture
Consists of a main module and a separate worker script that loads dynamically only when needed, allowing for flexible deployment and bundling strategies.
import QrScanner from 'qr-scanner';
const videoElem = document.getElementById('video');
const qrScanner = new QrScanner(
videoElem,
result => console.log('Decoded QR:', result.data),
{ highlightScanRegion: true }
);
qrScanner.start();Top in Developer Tools
Related Repositories
Discover similar tools and frameworks used by developers
Colima
Lima-based container runtime provisioning for macOS and Linux.
plotly.py
Interactive browser-based charts from Python with declarative API.
GraphiQL
Browser-based GraphQL IDE with language service tooling.
Create T3 App
Interactive CLI for scaffolding typesafe Next.js applications with the T3 Stack technology combination.
Instaloader
Python CLI for downloading Instagram posts, stories, profiles, and metadata.