![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
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.
The npm package hid-barcode-scanner receives a total of 0 weekly downloads. As such, hid-barcode-scanner popularity was classified as not popular.
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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.