
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Node.js binding for reading text inputs on Linux, such as barcode scanners.
Features:
input_event
EVIOCGRAB
) opennpm install --save hid-input
npm install --save hid-input --build-from-source
Additional build dependencies are required on different platforms:
sudo apt install -y build-essential cmake ninja-build
brew install cmake ninja
import { createInput, listInputs } from 'hid-input';
const inputs = await listInputs();
console.log(inputs);
const reader = createInput(inputs[0].path);
reader.once('open', ()=>{
console.log('device opened');
});
reader.on('data', (input) => {
console.log(`- scanned: ${input}`);
});
listInputs()
Promise<InputDevice[]>
path
- string
Path to the devicename
- string
Human readable name of the deivceList HID input devices available on this machine.
createInput(path[, options])
path
- string
options
- Object
exclusive
- boolean
Whether to prevent the device from being opened by other processes before getting closedHidInputStream
Opens an input stream of device path
. Available devices along with paths can be retrieved with listInputs()
.
createMockInput(path)
path
- string
HidInputStream
Opens a mocking stream by listening on a newly created UNIX domain socket path
.
After the stream is open, you can emulate inputs with nc -U <path>
.
HidInputStream
fs.Readable
A readable stream in Object mode.
open
close
data
input
- string
Input read from the deviceclose()
Close the stream and release any underlying resources.
FAQs
Node.js binding for reading text inputs on Linux, such as barcode scanners
The npm package hid-input receives a total of 1 weekly downloads. As such, hid-input popularity was classified as not popular.
We found that hid-input 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.