Read label images
Pass a Buffer or Uint8Array of PNG, JPEG, WebP or GIF bytes to scan(). A Code 128 label encoding STOCK-4827 returns that exact string.
npm + 6 addons
Node.js 18+
1D + 2D
MIT
Decode retail, warehouse and 2D matrix label buffers inside Node.js servers and workers using prebuilt Rust N-API addons.
Pass a Buffer or Uint8Array of PNG, JPEG, WebP or GIF bytes to scan(). A Code 128 label encoding STOCK-4827 returns that exact string.
Async scan() executes native Rust decoding on libuv worker threads so API servers stay responsive while handling label uploads.
Restrict active symbologies via formats, keep content.text as a string so leading zeros survive and query your own inventory database.
Install the native npm package, filter formats in scan() and return exact identifier strings off the event loop.
Requires Node.js 18 or later. Install @qrcode-ai-com/qrcode-barcode-scanner on npm with optional dependencies enabled so your package manager downloads the matching prebuilt native addon for your host.
Six native packages ship 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 native addon and there is no WASI fallback.
For browser web apps or raw camera frames, use the JavaScript Barcode Scanner SDK WASM package.
Pass a Buffer or Uint8Array (PNG, JPEG, WebP or GIF) to scan() with formats set to the barcode symbologies your backend expects. No reader outside that list executes.
To test your pipeline locally, generate a Code 128 barcode with Code 128 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 set budgetMs: 0) when reading scuffed, 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 as needed.
For a Code 128 label encoding STOCK-4827, readBarcodes resolves to [{ symbology: "code128", text: "STOCK-4827" }]. A UPC-A code such as 012345678905 keeps its leading zero intact as a JavaScript string.
A blank image or one holding only excluded symbologies resolves to []. Confirm report.trace.budget_exhausted === false; invalid files or unknown format names reject with [QRS-xxx].
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 and ITF-14 to itf).
Server safety and threading. Async scan() runs on libuv worker threads and accepts AbortSignal; tighten maxDimension and maxPixels below the 10,000 px / 64M pixel defaults for public uploads. Keep identifiers as strings and handle product lookups separately.
Addon loading and MIT licence. Missing optional platform packages throw Cannot find native binding at load time. Current releases ship under the MIT licence; see the Node.js package README and Node.js API documentation.
Official package guides, ScanReport specification and licensing references.
Native addons, formats, leading zeros, libuv workers, limits and licensing.
It is QR Code AI’s open-source MIT-licensed native Node.js package (@qrcode-ai-com/qrcode-barcode-scanner) backed by prebuilt Rust N-API addons for decoding 16 1D and 2D barcode formats (as well as QR codes) inside Node.js 18+.
It reads 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 formats to run only the decoders your workflow requires.
Six optional packages are published on npm: darwin-arm64, darwin-x64, linux-arm64-gnu, linux-x64-gnu, linux-x64-musl and win32-x64-msvc. Leave optional dependencies enabled; ARM64 musl is not provided and there is no WASI fallback.
It never drops leading zeros and does not perform product lookups. Each detection returns content.text as a string alongside its symbology (plus parsed GS1 elements when recognised); query your own catalogue or inventory database separately.
@qrcode-ai-com/qrcode-barcode-scanner executes native Rust addons in Node.js for encoded PNG, JPEG, WebP or GIF buffers. For browser web apps, live camera frames or hosts lacking a native binary, use the JavaScript Barcode Scanner SDK WASM package.
A blank image resolves with an empty detections array (check trace.budget_exhausted === false). Unreadable files, images past maxDimension or maxPixels, or unknown format names reject with [QRS-xxx] error codes.
No. Decoding runs locally in process inside the native addon with zero network calls, no QR Code AI account, no API key and no creation credits.
Yes. Current releases are MIT-licensed for commercial and proprietary Node.js backends while keeping copyright and licence notices intact (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.