{"_id":"@c8h_/keyboard.js","_rev":"1-98aba49b91951fc8ecb62846cdc78ca5","name":"@c8h_/keyboard.js","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@c8h_/keyboard.js","version":"0.1.0","description":"Listen for keyboard events from stdin easier","main":"src/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/c8hunderscore/keyboard.js.git"},"keywords":["keyboard","stdin"],"author":{"name":"c8h_"},"license":"MIT","bugs":{"url":"https://github.com/c8hunderscore/keyboard.js/issues"},"homepage":"https://github.com/c8hunderscore/keyboard.js#readme","gitHead":"261b071cf48f25d8eb57f791a7ce2ae4ffc93c34","_id":"@c8h_/keyboard.js@0.1.0","_nodeVersion":"14.15.4","_npmVersion":"7.16.0","dist":{"integrity":"sha512-nb4H51Now6AkR6upoPSsX/owLDJcxCVtQpGXHn3PNx63JxmTQ8VB/MqUvagqmQhiaegNtBN94a8nUdG0hU5wFw==","shasum":"9ba9d46ec8bc4010f91b991b86b5d8291e3980f3","tarball":"https://registry.npmjs.org/@c8h_/keyboard.js/-/keyboard.js-0.1.0.tgz","fileCount":6,"unpackedSize":3959,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg06YXCRA9TVsSAnZWagAAkcUP/A9g48YOU1eNd2APLxD4\nx24+dCOEj3kQ8PXkt4lQoJ0+mB8rCL088EGDYzHoOXI50ZSWCF08d/wJzDQx\nFF/+nof5aq+Ls9GQioC6oJ3pUpwPLpCdfJHR85kOhouSaZiCrZYvZWFojh6/\ndGaDAGdRohibWcFVehvzGAN0oVZ8NHgI4TxEMt9A52Uxz5YAXtsgukpd4IAd\noc94KKvZBShW+fbCPhN88jDwQioWp1FhyaqHGGt8irSu9cpQieXAK6IaM1gT\niqifV/zp9F8Oo3QA0CvWCcTgICt4YlZi5OIvk/ShkBDTFYxh6petuPp3l75g\nfiY2PYcMSQ/DncVjeIRfEllNn6pTD/BZSvm6SnyaVkqrgIydsKj6kz11K+5D\n/tVOJoP3gQwsoWrR9wxi1EIifmMB9mzu/SbEebpsMlvaE5+SIvFwDd2A5eQu\nsz5WF68sZqYzYcboJIQwpy5sqcZTsHrFIoTm6Qq/jNEUk7yIHrD1lHY3uD+H\ngt2R2aCggF6BYNCK70V1R//UmXdjJfQfDRmva7JFV1cirkmlecQfs8xMPO8+\nAROF46lWYg3pDG3KZKfYJzUGspjJTC+VoZc130tLd3qME27kGFvlFwS+L9HY\netHqhD+TKjace2MJRuBK5nI+a8Nantj/j8+gxPNNnvK0q/oInUMLySBnoxgZ\nKcP/\r\n=7XMK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDqKCAE5LsTJLtC4XdkfDatSlu47v0kjSr7kHwujFGuhgIgKf/LlvMAEmFyEdvO9eSDf5Gkz9hcvlJla5i28Yz2uL0="}]},"_npmUser":{"name":"c8h_","email":"sunyt69@gmail.com"},"directories":{},"maintainers":[{"name":"c8h_","email":"sunyt69@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/keyboard.js_0.1.0_1624483351059_0.11976144926084542"},"_hasShrinkwrap":false}},"time":{"created":"2021-06-23T21:22:30.995Z","0.1.0":"2021-06-23T21:22:31.164Z","modified":"2022-04-04T21:25:54.636Z"},"maintainers":[{"name":"c8h_","email":"sunyt69@gmail.com"}],"description":"Listen for keyboard events from stdin easier","homepage":"https://github.com/c8hunderscore/keyboard.js#readme","keywords":["keyboard","stdin"],"repository":{"type":"git","url":"git+https://github.com/c8hunderscore/keyboard.js.git"},"author":{"name":"c8h_"},"bugs":{"url":"https://github.com/c8hunderscore/keyboard.js/issues"},"license":"MIT","readme":"# keyboard.js\nA Keyboard library for NodeJS\n\n## Usage\nkeyboard.js has a default export, being the `Keyboard` class.\nTo create a new `Keyboard`, add this to your code:\n```js\nconst Keyboard = require(\"keyboard.js\");\nconst kb = new Keyboard();\n```\n`Keyboard` inherits `EventEmitter`. It emits events through `.on()`, `.once()`, `.addListener()`.\nBy default, the `Keyboard` will emit in the following format:\n```\nC-M-{key}\ne.g.\nC-c == control + c\nM-k == windows + k\nB   == shift   + b\n```\nTo listen for these, you can add event listeners. Here's how:\n```js\nkb.on(\"C-c\", () => process.exit()); // Exit when ctrl+c is pressed\n```\n\n## Config\nWhen creating your `Keyboard`, you can specify custom options:\n```js\n// All of these are their default options\nconst kb = new Keyboard(process.stdin, {\n    encoding: \"utf8\",\n    rawMode: true,\n    longKeyNames: false,\n    seperator: \"-\",\n});\n```\nLet's run through what each one of these do.\n\n### Stream\nDeafult: `process.stdin`\nThe stream to read.\n\n### Encoding\nDefault: `\"utf8\"`\nThe encoding to read the stream in.\n\n### Raw Mode\nDefault: `true`\nWhether to enable raw mode for the stream, recommended if using keyboard shortcuts.\n\n### Long Key Names\nDefault: `false`\nIf enabled, replace `C-` with `ctrl-` and `M-` with `meta-` in the events\n\n### Seperator\nDefault: `\"-\"`\nA seperator which goes after each modifier key in the listeners.\n\n## `Event`\n`Event` is a class which is returned on every event.\n","readmeFilename":"README.md"}