Node.js Barcode Scanner SDK

Add native offline 1D and 2D barcode scanning to your Node.js server, background worker or utility script. Install a single MIT-licensed npm package with six prebuilt platform addons, pass label image buffers to async scan() and get exact identifier strings with their symbology.

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

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

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

Inspect the decoded identifierSTOCK-4827

Read label images

Pass a Buffer or Uint8Array containing PNG, JPEG, WebP or GIF bytes to scan(). A Code 128 label encoding STOCK-4827 returns that exact string.

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

Need to scan a barcode right away? Open the online reader

Node.js Barcode Scanner SDK at a glance

  • Prebuilt native binaries, no Rust needed

    npm + 6 addons

  • Async libuv worker + TypeScript types

    Node.js 18+

  • EAN, UPC, Code 128, Data Matrix & more

    1D + 2D

  • Open-source licence

    MIT

Run native barcode scanning in Node.js

Decode retail, warehouse and 2D matrix label buffers inside Node.js backends and worker queues with prebuilt Rust N-API addons.

Read label images

Pass a Buffer or Uint8Array containing PNG, JPEG, WebP or GIF bytes to scan(). A Code 128 label encoding STOCK-4827 returns that exact string.

Offload to libuv workers

Async scan() executes native Rust decoding on libuv worker threads so API servers stay responsive while processing label uploads.

Keep exact strings & formats

Filter active symbologies using formats, store content.text as a string so leading zeros survive and query your own inventory database.

Add barcode image scanning in Node.js

Install the native npm package, pass formats to scan() and return exact identifier strings 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 downloads the prebuilt native addon for your host.

Six native optional packages are published on npm: darwin-arm64, darwin-x64, linux-arm64-gnu, linux-x64-gnu, linux-x64-musl and win32-x64-msvc. No Rust compiler is needed.

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

Keep optional dependencies enabled; ARM64 musl has no prebuilt addon and there is no WASI fallback.

For browser web apps or raw camera frames, switch to the JavaScript Barcode Scanner SDK WASM package.

Decode a barcode image buffer asynchronously

Pass a Buffer or Uint8Array (PNG, JPEG, WebP or GIF) to scan() with formats listing the barcode symbologies your backend expects. No reader outside that list executes.

To test your upload pipeline end to end, create a Code 128 barcode with Barcode Generator encoding STOCK-4827 and scan the exported PNG.

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

const FORMATS = ["code128", "code39", "ean13", "ean8", "upc_a", "upc_e", "itf", "data_matrix"];

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

Switch profile to "full" (or pass budgetMs: 0) when decoding worn, angled or low-contrast label photos.

Add extra symbologies such as pdf417, aztec, code93, codabar, data_bar, data_bar_expanded, telepen or maxi_code to FORMATS whenever needed.

Inspect the decoded identifier

For a Code 128 label encoding STOCK-4827, readBarcodes resolves to [{ symbology: "code128", text: "STOCK-4827" }]. A UPC-A string such as 012345678905 keeps its leading zero intact in JavaScript.

A blank image or one holding only unrequested symbologies resolves to []. Confirm report.trace.budget_exhausted === false; invalid files or unknown format names reject with [QRS-xxx].

Native addon loading, barcode formats and server caps

Sixteen barcode formats. Decodes EAN-13, EAN-8, UPC-A, UPC-E, Code 128, Code 39, Code 93, Codabar, ITF, Telepen, GS1 DataBar, GS1 DataBar Expanded, Data Matrix, PDF417, Aztec and MaxiCode (ISBN maps to ean13, GS1-128 to code128, ITF-14 to itf).

Server safety and worker threads. Async scan() runs on libuv worker threads and accepts AbortSignal; tighten maxDimension and maxPixels below the 10,000 px and 64M pixel defaults for public uploads. Keep identifiers as strings and query product catalogues separately.

Addon loading and MIT licence. Missing optional platform binaries throw Cannot find native binding when loaded. Current releases use the MIT licence; see the Node.js package README and Node.js API docs.

Node.js Barcode Scanner documentation and licence

Official package guides, ScanReport schema specification and licensing notices.

Node.js Barcode Scanner SDK questions

Native addons, supported formats, leading zeros, libuv workers, upload caps and licensing.

It is QR Code AI’s open-source MIT-licensed native Node.js package (@qrcode-ai-com/qrcode-barcode-scanner) powered by prebuilt Rust N-API addons for decoding 16 linear and 2D barcode formats (as well as QR codes) inside Node.js 18+.

It decodes EAN-13, EAN-8, UPC-A, UPC-E, Code 128, Code 39, Code 93, Codabar, ITF, Telepen, GS1 DataBar, GS1 DataBar Expanded, Data Matrix, PDF417, Aztec and MaxiCode, along with QR Code, Micro QR and rMQR. Pass the formats option to execute only the readers you need.

Six prebuilt optional packages are published on npm: darwin-arm64, darwin-x64, linux-arm64-gnu, linux-x64-gnu, linux-x64-musl and win32-x64-msvc. Keep optional dependencies enabled; ARM64 musl has no native addon and there is no WASI fallback.

No. It never fetches product details and keeps every leading zero intact. Each detection exposes content.text as a JavaScript string alongside symbology (and parsed GS1 fields when recognised); query your own catalogue or inventory database separately.

@qrcode-ai-com/qrcode-barcode-scanner uses compiled native Rust addons in Node.js for encoded PNG, JPEG, WebP or GIF buffers. For browser web apps, camera capture or hosts lacking a native addon, use the JavaScript Barcode Scanner SDK WASM package.

A blank image resolves to an empty detections array (confirm trace.budget_exhausted === false). Unreadable files, images above maxDimension or maxPixels, or unrecognised format names reject with [QRS-xxx] error codes.

No. Decoding runs locally in process inside the native addon with zero network traffic, no QR Code AI account, no API key and no creation credits.

Yes. Current releases ship under the MIT licence for commercial and proprietary backend services while preserving copyright and licence notices (check LICENSING.md for third-party Apache-2.0 notices). SDK usage is separate from QR Code AI’s paid creation plans and seven-day Premium trial.