console-prompt

1.0.0 • Public • Published

Console prompt

Prompts the user for information at the console in a nodejs programme.

Returns a Promise.

var prompt = require('console-prompt');
prompt( 'password\n', 'hidden' )
    .then( function(value) {
        console.log( "You've entered password", value );
    } );

prompt takes two parameters:

  • message - String - text to display on the screen
  • hidden - Truthy - if truthy the user's input is replaced with stars.

Installation

$ npm install console-prompt

Issues

Pasting

The code reacts badly to \n, and possibly many other characters, being pasted in. Avoid.

Windows

In Windows, backspacing in a hidden field won't update on screen correctly unless you are using a terminal supporting ANSI escape sequences.

It should still collect the correct information, though.

Readme

Keywords

Package Sidebar

Install

npm i console-prompt

Weekly Downloads

41

Version

1.0.0

License

ISC

Last publish

Collaborators

  • mrdaniellewis