node-pause

1.0.1 • Public • Published

Node Pause

Simple module to wait for a key be pressed to continue, like the "pause" command in windows command prompt.

Installation

npm install --save node-pause

or

yarn add node-pause

Usage

const pause = require('node-pause');

The pause function recieves an optional parameter with the message that will be displayed, this function returns a promisse that will be called when any key is pressed returning the key character.

const pause = require('node-pause');
 
console.log('My special message :D');
 
pause('Press any key to continue.... :X')
    .then(() => {
        console.log('\n\nAnother special message');
        return pause('Press any key to exit');
    })
    .then(key => {
        console.log(`\n\nYou pressed "${key}" and the process will exit`);
        
        process.exit();
    });
 

Readme

Keywords

none

Package Sidebar

Install

npm i node-pause

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

3.24 kB

Total Files

6

Last publish

Collaborators

  • abnerfs