Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
hid-barcode-scanner
Advanced tools
A JavaScript library for using USB barcode scanners in NodeJS applications.
A JavaScript library for using USB barcode scanners in NodeJS applications.js.
You can install this package by running the following command:
npm i hid-barcode-scanner --save
You can list all devices using the following code:
let getDevices = require('hid-barcode-scanner').getDevices;
console.log(getDevices());
Or search for a specific device using the following:
let getDeviceByPath = require('./usb-barcode-scanner').getDeviceByPath;
console.log(getDeviceByPath('/dev/hidraw0'));
let getDevicesByIds = require('./usb-barcode-scanner').getDevices;
console.log(getDevicesByIds(1529,8721));
Depending on the method used, a devices will show up as an array of objects or a single object in the following format:
{
vendorId: 1529,
productId: 8721,
path: '/dev/hidraw0',
serialNumber: 'S/N E22A03870',
manufacturer: 'Datalogic ADC, Inc.',
product: 'Handheld Barcode Scanner',
release: 131,
interface: 0,
usagePage: 1,
usage: 6
}
General usage is as follows:
let UsbScanner = require('hid-barcode-scanner').UsbScanner;
let scanner = new UsbScanner({
vendorId: 1529,
productId: 8721
});
scanner.events.on('data', (data) => {
console.log(data);
});
scanner.events.on('error', (error) => {
console.log(error);
});
scanner.startScanning();
To stop scanning, you can use:
scanner.stopScanning();
FAQs
A JavaScript library for using USB barcode scanners in NodeJS applications.
We found that hid-barcode-scanner demonstrated a not healthy version release cadence and project activity because the last version was released 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.