Skip to content
Prompts for a single keypress in a node.js CLI app
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
example.js
index.js
package-lock.json
package.json
test.js

README.md

clikey

Prompts for a single keypress in a node.js CLI app

Usage

#!/usr/bin/env node
'use strict';

const clikey = require('clikey');

(async () => {
    const answer = await clikey('Are you sure? [y/N]');
    // answer received when a single key is pressed

    if (answer.toLowerCase() === 'y') {
        return console.log('You said YES!!!');
    }

    console.log('You said NO');
})();

Install

$ npm install --save clikey

Test

$ npm install && npm test
You can’t perform that action at this time.