Node.js QR Code Scanner SDK

Add native offline QR code scanning to your Node.js server, worker or local script. Install one MIT-licensed npm package with six prebuilt native platform addons, pass Buffer or Uint8Array bytes to async scan() and get typed detections and QR quality scores.

JavaScript
import { scan } from "@qrcode-ai-com/qrcode-barcode-scanner";

const report = await scan(imageBytes, { profile: "frame" });
const qr = report.detections.find(d => d.symbology === "qr_code");

console.log(qr?.content.text);

Inspect the decoded resulthttps://qrcode-ai.com/

Read saved QR images

Pass a Buffer or Uint8Array of PNG, JPEG, WebP or GIF bytes to scan() and receive decoded URLs, text and QR quality diagnostics.

npm install @qrcode-ai-com/qrcode-barcode-scanner

Want to scan a code now? Open the online reader

Node.js QR Code Scanner SDK at a glance

  • Prebuilt native binaries, no Rust needed

    npm + 6 addons

  • Async libuv worker + TypeScript types

    Node.js 18+

  • Zero network requests or subprocesses

    In-process

  • Open-source license

    MIT

Run native QR scanning in Node.js

Decode uploaded or local QR images in server routes and worker queues using prebuilt Rust N-API addons.

Read saved QR images

Pass a Buffer or Uint8Array of PNG, JPEG, WebP or GIF bytes to scan() and receive decoded URLs, text and QR quality diagnostics.

Offload to libuv workers

Async scan() runs native Rust decoding on libuv worker threads so HTTP handlers stay responsive; scanSync() is ready for blocking scripts.

Typed ScanReport & options

Ships TypeScript declarations plus formats filtering, maxDimension/maxPixels caps, budgetMs control and AbortSignal support.

Add QR image reading in Node.js

Install the native npm package, read an image Buffer and await scan() off the event loop.

Install the native Node.js package

Requires Node.js 18 or later. Install @qrcode-ai-com/qrcode-barcode-scanner on npm with optional dependencies enabled so npm selects the prebuilt native addon for your host.

Six prebuilt targets ship on npm: macOS (darwin-arm64, darwin-x64), GNU/Linux (linux-arm64-gnu, linux-x64-gnu), Linux musl x64 (linux-x64-musl) and Windows x64 (win32-x64-msvc). No Rust compiler is needed.

npm install @qrcode-ai-com/qrcode-barcode-scanner

Do not install with --omit=optional: an ARM64 musl addon is not provided and there is no WASI fallback.

For browser apps, camera frames or hosts without a native addon, use the separate JavaScript QR Code Scanner SDK WASM package.

Decode a QR image buffer asynchronously

Pass a Buffer or Uint8Array (PNG, JPEG, WebP or GIF) to scan(). Set formats: ["qr_code"] to skip barcode readers, and lower maxDimension and maxPixels when scanning untrusted user uploads.

import { readFile } from "node:fs/promises";
import { scan } from "@qrcode-ai-com/qrcode-barcode-scanner";

export async function readQrImage(filePath) {
  const bytes = await readFile(filePath);
  const report = await scan(bytes, {
    profile: "full",
    formats: ["qr_code"],
    maxDimension: 4096,
    maxPixels: 16_000_000,
  });
  return report.detections
    .filter((d) => d.content.charset !== "unknown")
    .map((d) => d.content.text);
}

Default profile budgets are full (4000 ms), fast (800 ms) and frame (80 ms); pass budgetMs: 0 for an unbounded scan.

Pass signal (an AbortSignal) to reject queued tasks with AbortError before execution starts; a running scan finishes normally.

Inspect the decoded result

For a QR image encoding https://qrcode-ai.com/, readQrImage resolves to ["https://qrcode-ai.com/"]. Inspect report.score for QR quality diagnostics (null means unmeasured, never zero).

An image with no QR code resolves with an empty detections array (confirm report.trace.budget_exhausted === false). Invalid inputs or options reject with [QRS-xxx] error codes.

Native addon loading, limits and worker execution

Async vs sync API. Use scan() to keep native Rust work on libuv worker threads, scanSync() only when deliberate blocking is acceptable, and capabilities() to inspect compiled readers.

Limits and addon loading. Default caps are 10,000 px per side and 64 million pixels; invalid options reject with [QRS-006]. A missing platform addon throws Cannot find native binding at load time rather than a [QRS-xxx] scan fault.

Browser separation and MIT license. Raw camera capture belongs in the browser WASM package. Current releases are MIT-licensed (with Apache-2.0 notices in LICENSING.md); see the Node.js package README and Node.js API docs.

Node.js QR Code Scanner documentation and license

Official package documentation, ScanReport specification and licensing references.

Node.js QR Code Scanner SDK questions

Native addons, platforms, libuv async, TypeScript, browser WASM and licensing.

It is QR Code AI’s open-source MIT native Node.js package (@qrcode-ai-com/qrcode-barcode-scanner) backed by prebuilt Rust N-API addons. It decodes QR codes, Micro QR, rMQR and 16 barcode formats directly in Node.js 18+ without spawning a CLI subprocess.

Six native optional packages are published on npm: macOS Apple Silicon (darwin-arm64), macOS Intel (darwin-x64), GNU/Linux ARM64 (linux-arm64-gnu), GNU/Linux x64 (linux-x64-gnu), Linux musl x64 (linux-x64-musl) and Windows x64 (win32-x64-msvc). ARM64 musl is not provided, and there is no WASI fallback.

Use async scan() in servers, APIs and worker pools so Rust decoding runs on libuv worker threads without blocking the JavaScript event loop. Reserve scanSync() for simple CLI scripts or isolated tasks where blocking the calling thread is intentional.

@qrcode-ai-com/qrcode-barcode-scanner runs native compiled Rust addons in Node.js servers and accepts encoded PNG, JPEG, WebP or GIF buffers. For browser apps, camera capture or hosts without a native addon, use @qrcode-ai-com/qrcode-barcode-scanner-wasm (see the JavaScript QR Code Scanner SDK).

Yes. TypeScript declarations ship inside the package. Pass signal (an AbortSignal) to scan() to abort queued tasks before execution with an AbortError DOMException; a scan that has already started settles normally.

No code found resolves with an empty detections array (check trace.budget_exhausted === false). Unreadable files, oversized images or unknown format names reject with [QRS-xxx] codes, while missing native binaries throw Cannot find native binding at load time.

No. Once installed, all decoding runs locally in process with zero network requests, no QR Code AI account, no API key and no creation credits.

Yes. Current releases are MIT-licensed for commercial and proprietary applications while retaining copyright and license notices (see LICENSING.md for third-party Apache-2.0 notices). SDK use is separate from QR Code AI’s paid creation plans and seven-day Premium trial.