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 + 6 addons
Node.js 18+
1D + 2D
MIT
Decode retail, warehouse and 2D matrix label buffers inside Node.js backends and worker queues with prebuilt Rust N-API addons.
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.
Async scan() executes native Rust decoding on libuv worker threads so API servers stay responsive while processing label uploads.
Filter active symbologies using formats, store content.text as a string so leading zeros survive and query your own inventory database.
Install the native npm package, pass formats to 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 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.
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.
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].
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.
Official package guides, ScanReport schema specification and licensing notices.
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.