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
cadvisor
Daemon for monitoring container resource usage and metrics.
json-server
Zero-config REST API server from JSON files.
corepack
Enforces package manager versions specified in package.json.
UniTask
Zero-allocation async/await using structs and custom method builders.
redoc
React component rendering OpenAPI specifications as interactive HTML documentation.