1.0.0 • Published 9 years ago

console-prompt v1.0.0

Weekly downloads
31
License
ISC
Repository
github
Last release
9 years ago

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.