Socket
Book a DemoInstallSign in
Socket

linux-key-info

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

linux-key-info

A simple utility for getting key info for a given linux key code

1.0.2
latest
npmnpm
Version published
Maintainers
1
Created
Source

npm Github file size GitHub tag npm Bintray GitHub issues Maintainability Depfu

node-linux-key-info

A simple utility for getting key info for a given linux key code.

Installation:

# using npm
npm i --save linux-key-info

# or yarn
yarn add linux-key-info

Usage:


// get info for a given key code
const keyCodeInfo = require('linux-key-info').keyCodeInfo;

console.log(keyCodeInfo(30).name); // 'A'
console.log(keyCodeInfo(30).char); // 'A'

console.log(keyCodeInfo(1).name); // 'ESC'
console.log(keyCodeInfo(1).char); // ''

// list all known keys
const listAllKnownKeys = require('linux-key-info').listAllKnownKeys;

console.log('All known keys:',listAllKnownKeys());

Example usage with 'input-event' package

$ npm i input-event linux-key-info --save
const InputEvent = require('input-event');
const keyCodeInfo = require('linux-key-info').keyCodeInfo;

const input = new InputEvent('/dev/input/event0');
const keyboard = new InputEvent.Keyboard(input);

keyboard.on('keypress', (event) => {
  const info = keyCodeInfo(event.code);
  console.log(`Key pressed: code=${event.code}, name="${info.name}", char="${info.char}"`);
});

Keywords

keycode

FAQs

Package last updated on 08 May 2018

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.