npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

evdevlib

v2.0.0

Published

A small package for listening to Linux evdev (/dev/input/eventX) device streams in Node.js

Readme

evdevlib

A small package for listening to Linux evdev (/dev/input/eventX) device streams in Node.js

Usage

listDevices([options])

Lists available character devices.

  • options: An object used to provide optional arguments.
    • info: Automatically fetches the device name from /sys/class/input.
    • path: Which directory to scan for devices (default: /dev/input).

Example:

import { listDevices } from 'evdevlib';

console.log(listDevices()); // Prints: [ { path: '/dev/input/event0' }]
console.log(listDevices({ info: true })); // Prints: [ { path: '/dev/input/event0', name: 'Mouse' }]

Class: DeviceListener

Listens to a device's input stream

  • constructor(path, [...args]):
    • path: The path of the interface to listen to (e.g. /dev/input/event0)
    • args: Args to pass to the EventEmitter constructor
  • stop(): Destroys the read stream and stops listening for input.
  • events
    • data: Emitted when input is received from the device.
      • input: An object version of the input_event struct (see https://docs.kernel.org/input/input.html#event-interface).
    • error: Emitted when an 'error' event is received from the read stream.
      • error
    • close: Emitted when a 'close' event is received from the read stream.
    • end: Emitted after stop() or when an 'end' event is received from the read stream.

Example:

import { DeviceListener } from 'evdevlib';

let listener = new DeviceListener('/dev/input/event0');
listener.on('data', input => console.log(input));
listener.on('error', error => console.log('Error reading device input:', error));
console.log('Listening for input...');
// ...
listener.stop();
console.log('Stopped listening for input.');

An input event for relative mouse movement would look something like this:

{
    tv_sec: 1783887711n,
    tv_usec: 338192n,
    type: 'REL',
    code: 'REL_X',
    value: 1
}

See https://docs.kernel.org/input/event-codes.html#input-event-codes for all event types.