Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
barcode4nodejs
Advanced tools
The Node.js barcode QR code SDK is implemented by wrapping Dynamsoft Barcode Reader C++ SDK. It helps developers to build Node.js barcode and QR code scanning applications for Windows, Linux, macOS, Raspberry Pi and Jetson Nano.
Platform-specific C/C++ compiler
node-gyp
npm i node-gyp -g
Linear Barcodes (1D)
2D Barcodes
Patch Code
GS1 Composite Code
GS1 DataBar
Postal Codes
initLicense(license-key)
decodeFileAsync(fileName, barcodeTypes, callback, template)
or await decodeFileAsync(fileName, barcodeTypes, template)
decodeFileStreamAsync(fileStream, fileSize, barcodeTypes, callback, template)
or await decodeFileStreamAsync(fileStream, fileSize, barcodeTypes, template)
decodeBase64Async(base64, barcodeTypes, callback, template)
or await decodeBase64Async(base64, barcodeTypes, template)
decodeYUYVAsync(buffer, width, height, barcodeTypes, callback, template)
or await decodeYUYVAsync(buffer, width, height, barcodeTypes, template)
decodeBufferAsync(buffer, width, height, stride, barcodeTypes, callback, template, maxBufferLength)
or await decodeBufferAsync(buffer, width, height, stride, barcodeTypes, template, maxBufferLength)
For example:
let params = {
"ImageParameter": {
"Name": "Custom_143301_827",
"BarcodeFormatIds": [
"BF_ALL"
],
"DeblurLevel": 9,
"ExpectedBarcodesCount": 100,
"ScaleDownThreshold": 1200000,
"Timeout": 100000
},
"Version": "3.0"
};
template = JSON.stringify(params);
const dbr = require('barcode4nodejs');
dbr.initLicense("DLS2eyJoYW5kc2hha2VDb2RlIjoiMjAwMDAxLTE2NDk4Mjk3OTI2MzUiLCJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSIsInNlc3Npb25QYXNzd29yZCI6IndTcGR6Vm05WDJrcEQ5YUoifQ==")
dbr.decodeFileAsync("YOUR IMAGE FILE", dbr.formats.OneD | dbr.formats.PDF417 | dbr.formats.QRCode | dbr.formats.DataMatrix | dbr.formats.Aztec, function(err, msg){
console.log(msg);
for (index in msg) {
result = msg[index];
console.log('Format: ' + result['format']);
console.log('Value : ' + result['value']);
console.log('x1: ' + result['x1']);
console.log('y1 : ' + result['y1']);
console.log('x2: ' + result['x2']);
console.log('y2 : ' + result['y2']);
console.log('x3: ' + result['x3']);
console.log('y3: ' + result['y3']);
console.log('x4: ' + result['x4']);
console.log('y4 : ' + result['y4']);
}
}, "");
// Or
(async function () {
try {
var result = await dbr.decodeFileAsync("YOUR IMAGE FILE", dbr.formats.OneD | dbr.formats.PDF417 | dbr.formats.QRCode | dbr.formats.DataMatrix | dbr.formats.Aztec, "");
console.log(result);
} catch (error) {
console.log(error);
}
})();
Get the source code:
git clone https://github.com/yushulx/nodejs-barcode.git
Download Dynamsoft C++ Barcode SDK. Copy header files to src
folder and copy platform-specific shared libraries to platforms
folder.
Edit src/dbr.cc
and index.js
.
Build the Node.js extension:
node-gyp configure
node-gyp build
For Visual Studio 2019 Community
node-gyp configure --msbuild_path="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" --msvs_version=2017
node-gyp build
examples/command-line
node test.js -f test.tif
examples/web
npm install
node server.js
Open http://localhost:2018/index.htm
in web browsers.
examples/desktop-electron
cd src
node-gyp rebuild --target=0.36.7 --arch=x64 --dist-url=https://atom.io/download/atom-shell
cd examples/desktop-electron
npm install
npm start
examples/linux-camera
npm install v4l2camera
node camera_barcode_reader.js
examples/RESTful-service
npm install restify
node server.js
Open https://< ip >:2018
to scan barcodes in web browsers.
FAQs
Node.js bindings to Dynamsoft Barcode Reader C/C++ SDK.
The npm package barcode4nodejs receives a total of 11 weekly downloads. As such, barcode4nodejs popularity was classified as not popular.
We found that barcode4nodejs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.