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);
let read=readline.createInterface({ input: process.stdin, output: process.stdout
function viewError(_data) { console.log('\033[2J'); console.log('Error occured: ' + _data); var readLine1 = Readline.createInterface({input: process.stdin, output: process.stdout}); readLine1.question("Press [ENTER] to start at root again!", (_input) => { readLine1.close(); idStack = []; browse("0"); }); }
/** * * @param {File|String} file - the file to create a readstream for */ function configureReadStream(file) { const readStream = fs.createReadStream(file, 'utf8'); const rl = readline.createInterface({ input: readStream, crlfDelay: Infinity }); return rl; }
const readFileByLine = (name, callback) => { const lineReader = readline.createInterface({ input: fs.createReadStream(path.resolve(__dirname, name)) }); lineReader.on('line', line => { callback && callback(line); }); }
// Simulate SIGINT on Windows (see http://stackoverflow.com/questions/10021373/what-is-the-windows-equivalent-of-process-onsigint-in-node-js) createInterface({ input: process.stdin, output: process.stdout }) .on('SIGINT', () => process.emit('SIGINT'));
function signin (name, sub, options) { rl = readline.createInterface({ input: process.stdin, output: process.stdout }) if (options.github) { ssoAuth('github') } else if (options.google) { ssoAuth('google-oauth2') } else { emailAuth() } }
it('aborts when an error occurs during the job', function(done) { var parent = spawn('node', [runnerPath, '-n', 6, '-m', machinesWithWrongPass, jobPath]); var parentStderr = []; var stderrRlInterface = readline.createInterface({input: parent.stderr}); stderrRlInterface.on('line', (line) => { parentStderr.push(line); }); parent.on('exit', () => { expect(parentStderr).to.include('[Aborted]: 127.0.0.1:8000 incorrect password'); // wait for a second for the beacons to clear there data structures setTimeout(done, 1500); }); });
function getUserTeam (teams, cb) { rl = readline.createInterface({ input: process.stdin, output: process.stdout }) const prompt = teams.map((team, index) => { return `${index + 1}: ${team.name} (${team.role})` }) prompt.push('Enter the number of the NodeSource Team would you like to use for this session: ') rl.question(prompt.join('\n'), index => { rl.close() cb(teams[parseInt(index) - 1]) }) }
constructor(Server){ let CommandSender = new ConsoleCommandSender(Server); let rl = readline.createInterface({ input: process.stdin }); rl.on("line", (input) => { Server.getCommandMap().dispatchCommand(CommandSender, input); }); }
const program = () => { if (!type || !name) { rl = readline.createInterface({ input: process.stdin, output: process.stdout, }); console.clear(); rl.question('어떤 템플릿이 필요하십니까? ', typeAnswer); } else { makeTemplate(); } }
private createReadlineInterface() { return createInterface({ input: process.stdin, output: process.stdout, }); }
constructor(nick) { this.nick = nick; this.rl = readline.createInterface({ input: process.stdin, output: process.stdout, terminal: false }); }
private createReadlineInterface() { return createInterface({ input: process.stdin, output: process.stdout, }); }