Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dev-input-reader

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dev-input-reader

read input from /dev/input/*

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

node-dev-input-reader

Read input from /dev/input/* on a linux Host.

feature

  • Detect double press / click
  • Detect long press / click
  • Detect Key combinaison
  • Support hardware disconnect / reconnect.
  • Can work from /dev/input/by-id/ and /dev/input/by-path/
  • Detect device type (event/joystick/mouse)
  • Writen in Typescript

usage

with raw event:

    // use RAW event
    const reader = new DevInputReader('event0');
    reader.on('error', console.error)
      .on("keyup", (data) => console.log('keyup:', data))
      .on("keypress", (data) => console.log('keypress:', data));

with syntetic events (recommanded):

    // use simple events
    const reader = new DevInputReader('event0'm { retryInterval: 10000});
    reader.on('error', console.error)
      .on("key", (data) => console.log('key:', data))
      .on("error", (data) => console.log('an error occure:', data))
    // data contain the durration of the press and the concurently press key
    // in case oh hardware lost, will reconnect every retryInterval 10sec

with syntetic events with double/long click detection (if needed):

    // use simple events
    const reader = new DevInputReader('event0', { retryInterval: 10000, longPress: 5000, doublePress: 300 });
    reader.on('error', console.error)
      .on("simple", (data) => console.log('simple press:', data))
      .on("double", (data) => console.log('double press:', data))
      .on("long", (data) => console.log('long press:', data))
    // long press is trigered if you keep a key pressed for more than 5 seconds
    // double press is trigered if press a key 2 time within 300 ms
    // in case oh hardware lost, will reconnect every retryInterval 10sec

FAQ

Why a new Module ?

There is a lot of existing module that can deal with input: dev-input Looks nice in typescript, but no docs, only used by hist owner. linux-keyboard-catcher highly Keyboard oriented, simple interface. node-keylogger very low level + forck from node-keyboard + contains bug.. raw-keyboard very low level + use C code.

Relative package: linux-key-info Key mapping for keyboard, I may integrate it on day.

Keywords

FAQs

Package last updated on 05 Oct 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc