{"id":15592050,"url":"https://github.com/derhuerst/cli-on-key","last_synced_at":"2025-06-26T13:32:48.932Z","repository":{"id":57107609,"uuid":"127540176","full_name":"derhuerst/cli-on-key","owner":"derhuerst","description":"Read command line key presses from process.stdin. Based on TooTallNate/keypress.","archived":false,"fork":false,"pushed_at":"2018-03-31T14:40:14.000Z","size":6,"stargazers_count":7,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-16T03:32:56.870Z","etag":null,"topics":["cli","command-line","key","keypress","stdin"],"latest_commit_sha":null,"homepage":"https://github.com/derhuerst/cli-on-key#cli-on-key","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/derhuerst.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-31T14:38:50.000Z","updated_at":"2021-11-19T19:01:39.000Z","dependencies_parsed_at":"2022-08-20T17:11:20.192Z","dependency_job_id":null,"html_url":"https://github.com/derhuerst/cli-on-key","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/derhuerst/cli-on-key","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fcli-on-key","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fcli-on-key/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fcli-on-key/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fcli-on-key/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/derhuerst","download_url":"https://codeload.github.com/derhuerst/cli-on-key/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derhuerst%2Fcli-on-key/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260552459,"owners_count":23026833,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command-line","key","keypress","stdin"],"created_at":"2024-10-02T23:53:40.921Z","updated_at":"2025-06-26T13:32:48.869Z","avatar_url":"https://github.com/derhuerst.png","language":"JavaScript","funding_links":["https://patreon.com/derhuerst"],"categories":[],"sub_categories":[],"readme":"# cli-on-key\n\n**Read command line key presses from process.stdin.** Based on [`TooTallNate/keypress`](https://github.com/TooTallNate/keypress).\n\n[![npm version](https://img.shields.io/npm/v/cli-on-key.svg)](https://www.npmjs.com/package/derhuerst/cli-on-key)\n![ISC-licensed](https://img.shields.io/github/license/derhuerst/cli-on-key.svg)\n[![chat with me on Gitter](https://img.shields.io/badge/chat%20with%20me-on%20gitter-512e92.svg)](https://gitter.im/derhuerst)\n[![support me on Patreon](https://img.shields.io/badge/support%20me-on%20patreon-fa7664.svg)](https://patreon.com/derhuerst)\n\n\n## Installing\n\n```shell\nnpm install @derhuerst/cli-on-key\n```\n\n\n## Usage\n\n`listen` will switch the stream to [raw mode](https://nodejs.org/api/tty.html#tty_readstream_israw), `stopListening` will revert to the previous value.\n\n```js\nconst listen = require('cli-on-key')\n\nconst stopListening = listen(process.stdin, (key) =\u003e {\n\tif (key.ctrl \u0026\u0026 key.name === 'c') {\n\t\tstopListening() // stop on Ctrl + C\n\t} else console.log(key)\n})\n```\n\n\n## Contributing\n\nIf you have a question or have difficulties using `cli-on-key`, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to [the issues page](https://github.com/derhuerst/cli-on-key/issues).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderhuerst%2Fcli-on-key","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fderhuerst%2Fcli-on-key","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderhuerst%2Fcli-on-key/lists"}