async function readLines(stream) { const rl = readline.createInterface({ input: stream, crlfDelay: Infinity }); return new Promise(resolve => { stream.once('error', _ => resolve(null)); const lines = []; rl.on('line', line => lines.push(line)); rl.on('close', _ => resolve(lines)); }); }
this.out = opts.stdout || process.stdout; this.onRender = (opts.onRender || (() => void 0)).bind(this); const rl = readline.createInterface(this.in); readline.emitKeypressEvents(this.in, rl); this.in.removeListener('keypress', keypress); if (this.in.isTTY) this.in.setRawMode(false); rl.close(); this.emit(this.aborted ? 'abort' : 'submit', this.value); this.closed = true;
let read=readline.createInterface({ input: process.stdin, output: process.stdout let question=function (title) { return new Promise(function (resolve,reject) { read.question(title,function (answer) { resolve(answer); })
rl.on('close', function() { // Print the welcome screen. util.log(''); util.log(fs.readFileSync('welcome.txt').toString().green); });
rl.on('line', function(line) { util.log( line.substring(0,4) + line.substring(4, 30).cyan.bold + line.substring(30, 33) + line.substring(33, 42).green.bold + line.substring(42) ); });
const Pregunta2 = () => { return new Promise((resolve, reject) => { rl.question('Ingrese su edad: ', (answer) => { return resolve(answer) }) }) }
const clearScreen = (from) => { if (from === undefined) { from = 0 } readline.cursorTo(process.stdout, 0, from) readline.clearScreenDown(process.stdout) }
private createReadlineInterface() { return createInterface({ input: process.stdin, output: process.stdout, }); }
rl.on('line', function (line) { lineno++; if (line === div) { record.push(lineno, bucket.join('\n')); records.push(record); record = [lineno + 1]; bucket = []; } else { bucket.push(line); } });
function stmt5(){ readline.question(`Have you finished configuring the env variables? [Y/n]`, (res5) => { switch(convertInput(res5)) { case 'y': siteFunc(true); break; default: console.log('please enter a valid yes/no response'); stmt5(); } }); }
constructor(nick) { this.nick = nick; this.rl = readline.createInterface({ input: process.stdin, output: process.stdout, terminal: false }); }