rl.setPrompt(prompt)
This
method sets the prompt that will be written to output whenever rl.prompt() is
called.
/* Import readline module */ var readline = require('readline'); /* * create a new readline.Interface instance that reads data from standard input * and write data to standard output */ var rl = readline.createInterface({ input: process.stdin, output: process.stdout }); rl.on('line', (data) => { console.log(`Hello ${data}, How are you`); rl.close(); }); rl.setPrompt("Please Enter your name : "); rl.prompt();
Output
Please
Enter your name : Krishna
Hello
Krishna, How are you
No comments:
Post a Comment