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 in Node.js servers and workers with pre-built 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() runs native Rust decoding on libuv worker threads so API servers stay responsive while processing label uploads.
Filter symbologies with formats, keep content.text as a string so leading zeros survive and query your own stock or inventory database.
Install the native npm package, restrict 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 npm selects the pre-built native addon for your host.
Six pre-built native packages ship on npm: darwin-arm64, darwin-x64, linux-arm64-gnu, linux-x64-gnu, linux-x64-musl and win32-x64-msvc. No Rust toolchain 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 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 server expects. No reader outside that list runs.
To test your pipeline, 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 reading worn, skewed or low-contrast label photos.
Add other 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 value such as 012345678905 keeps its leading zero intact as a JavaScript string.
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 threading. Async scan() runs on libuv worker threads and accepts AbortSignal; lower maxDimension and maxPixels from the 10,000 px / 64M pixel defaults for public uploads. Keep identifiers as strings and look up products separately.
Addon loading and MIT licence. Missing optional platform packages throw Cannot find native binding at load time. Current releases are MIT-licensed; see the Node.js package README and Node.js API docs.
Official package documentation, ScanReport specification and licensing references.
Native addons, formats, leading zeros, libuv workers, limits and licensing.
It is QR Code AI’s open-source MIT native Node.js package (@qrcode-ai-com/qrcode-barcode-scanner) backed by pre-built Rust N-API addons for decoding 16 1D and 2D barcode formats (plus QR codes) in 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, plus QR Code, Micro QR and rMQR. Use the formats option to run only the readers you need.
Six pre-built optional packages ship 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 is not provided and there is no WASI fallback.
It never strips leading zeros and does not look up product names. Each detection returns content.text as a string plus symbology (and parsed GS1 fields when recognised); query your own catalogue or stock database separately.
@qrcode-ai-com/qrcode-barcode-scanner uses native Rust addons in Node.js for encoded PNG, JPEG, WebP or GIF buffers. For browsers, camera frames or hosts without a native addon, use the JavaScript Barcode Scanner SDK WASM package.
A blank image resolves with an empty detections array (confirm trace.budget_exhausted === false). Unreadable files, images above maxDimension/maxPixels or unknown formats reject with [QRS-xxx] error codes.
No. Decoding runs locally in process inside the native addon with zero network calls, requiring no internet access, QR Code AI account, API key or creation credits.
Yes. Current releases are MIT-licensed for commercial and proprietary software while retaining copyright and licence 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.