
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
@barkoder/barcode-nodejs-scanner
Advanced tools
High-performance Node.js barcode scanning SDK supporting 40+ barcode formats
High-performance Node.js barcode scanning SDK supporting 40+ barcode formats. Native C++ implementation with JavaScript/TypeScript bindings.
QR, QR Micro, PDF417, PDF417 Micro, DataMatrix, Aztec, Aztec Compact, MaxiCode, DotCode
Code128, Code93, Code39, Code32, Codabar, Code11, MSI, UPC-A, UPC-E, EAN-13, EAN-8
Code25, Interleaved 2/5, ITF-14, IATA 2/5, Matrix 2/5, Datalogic 2/5, COOP 2/5, Telepen
DataBar (RSS), Australian Post, Royal Mail, KIX, Japanese Post, PostNet, Planet, IMB
npm install @barkoder/barcode-scanner
Install system dependencies:
# Ubuntu/Debian
sudo apt-get install build-essential libcurl4-openssl-dev
# Amazon Linux/RHEL/CentOS
sudo dnf install gcc-c++ libcurl-devel
# Or use yum on older systems
sudo yum install gcc-c++ libcurl-devel
const BarkoderSDK = require('@barkoder/barcode-scanner');
// Initialize with your license key
const result = BarkoderSDK.initialize('YOUR_LICENSE_KEY');
console.log('SDK Status:', result);
// Configure for QR codes
BarkoderSDK.enableDecoders(['QR', 'PDF417']);
BarkoderSDK.setDecodingSpeed(BarkoderSDK.constants.DecodingSpeed.Normal);
// Decode from image buffer (grayscale)
const fs = require('fs');
// ... load your image as grayscale buffer ...
const result = BarkoderSDK.decodeImage(imageBuffer, width, height);
if (result.resultsCount > 0) {
console.log('Found barcode:', result.textualData);
console.log('Type:', result.barcodeTypeName);
} else {
console.log('No barcodes found');
}
Create a config.json file for your application. You can copy the included template:
# Copy the template (included in the package)
cp node_modules/@barkoder/barcode-scanner/config.template.json ./config.json
# Edit with your license key
nano config.json
{
"app_name": "my-barcode-app",
"license_key": "YOUR_ACTUAL_LICENSE_KEY_HERE",
"description": "My barcode scanning application",
"version": "1.0.0"
}
⚠️ Important: Never commit your actual license key to version control. Use environment variables or secure configuration management in production.
// Initialize from config file
const initResult = BarkoderSDK.initializeFromConfig('./config.json');
if (initResult.success) {
console.log('âś… SDK initialized successfully');
console.log('App:', initResult.config.app_name);
} else {
console.log('❌ Initialization failed:', initResult.status);
}
BarkoderSDK.getVersion(): stringGet the SDK library version.
BarkoderSDK.initialize(licenseKey: string): stringInitialize SDK with license key.
BarkoderSDK.isInitialized(): booleanCheck if SDK is initialized.
BarkoderSDK.initializeFromConfig(configPath?: string): InitializationResultInitialize SDK using configuration file.
BarkoderSDK.setEnabledDecoders(decoders: number[]): stringSet active barcode types using decoder constants.
const decoders = [
BarkoderSDK.constants.Decoders.QR,
BarkoderSDK.constants.Decoders.PDF417,
BarkoderSDK.constants.Decoders.Code128
];
BarkoderSDK.setEnabledDecoders(decoders);
BarkoderSDK.enableDecoders(decoderNames: string[]): stringHelper method using decoder names.
BarkoderSDK.enableDecoders(['QR', 'PDF417', 'Code128']);
BarkoderSDK.setDecodingSpeed(speed: number): stringSet performance vs accuracy trade-off.
// Available speeds
BarkoderSDK.constants.DecodingSpeed.Fast // 0 - Fastest
BarkoderSDK.constants.DecodingSpeed.Normal // 1 - Balanced (default)
BarkoderSDK.constants.DecodingSpeed.Slow // 2 - More thorough
BarkoderSDK.constants.DecodingSpeed.Rigorous // 3 - Most thorough
BarkoderSDK.setRegionOfInterest(left, top, width, height): stringSet scan area (values 0-100 as percentages).
// Scan full image
BarkoderSDK.setRegionOfInterest(0, 0, 100, 100);
// Scan center quarter
BarkoderSDK.setRegionOfInterest(25, 25, 50, 50);
BarkoderSDK.decodeImage(imageBuffer: Buffer, width: number, height: number): BarcodeResultDecode barcode from grayscale image buffer.
const result = BarkoderSDK.decodeImage(grayscaleBuffer, imageWidth, imageHeight);
// Single barcode result
if (result.resultsCount === 1) {
console.log('Type:', result.barcodeTypeName);
console.log('Data:', result.textualData);
console.log('Charset:', result.character_set);
}
// Multiple barcodes
if (result.resultsCount > 1) {
result.results.forEach((barcode, index) => {
console.log(`[${index}] ${barcode.barcodeTypeName}: ${barcode.textualData}`);
});
}
Full TypeScript definitions are included:
import BarkoderSDK, { BarcodeResult, DecoderName } from '@barkoder/barcode-scanner';
const decoders: DecoderName[] = ['QR', 'PDF417'];
BarkoderSDK.enableDecoders(decoders);
const result: BarcodeResult = BarkoderSDK.decodeImage(buffer, width, height);
try {
const result = BarkoderSDK.initialize(licenseKey);
if (result.startsWith('ERROR:')) {
throw new Error(`SDK initialization failed: ${result}`);
}
// Configure and scan...
const scanResult = BarkoderSDK.decodeImage(imageBuffer, width, height);
} catch (error) {
console.error('Barcode scanning error:', error.message);
}
Check the examples/ directory for complete working examples:
examples/decode-image.js - Complete image decoding example with BMP supportexamples/decode.js - Basic SDK usage examplegit clone <repository-url>
cd barkoder-nodejs
npm install
npm run build
npm test
This SDK requires a valid license key from Barkoder. The license key controls:
"SDK initialization failed"
"No module named 'BarkoderSDK'"
npm rebuild to recompile native module"No barcodes found"
Build failures
This package contains proprietary Barkoder SDK components. Contact Barkoder for licensing information.
Made with ❤️ by Barkoder
FAQs
High-performance Node.js barcode scanning SDK supporting 40+ barcode formats
The npm package @barkoder/barcode-nodejs-scanner receives a total of 24 weekly downloads. As such, @barkoder/barcode-nodejs-scanner popularity was classified as not popular.
We found that @barkoder/barcode-nodejs-scanner demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.