How to use the readline.createInterface function in readline

To help you get started, we’ve selected a few readline examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github skyujilong / tinypng-webpack-plugin / src / uploader.js View on Github external
yield new Promise(function (resolve, reject) {
        let rl = readline.createInterface({
            input: fs.createReadStream(dictPath)
        });
        rl.on('line', function (line) {
            //给dict对象 添加属性与对应的值
            if (line && line.indexOf(splitCode) >= 0) {
                let list = line.split(splitCode);
                dict[list[0]] = list[1];
            }
        });
        rl.on('close', function () {
            resolve(dict);
        })
    });
}
github nicksellen / german / bin / german-quiz.js View on Github external
function ask(question, callback) {
  var rl = require('readline').createInterface({
    input: process.stdin,
    output: process.stdout
  });
  rl.question(question, function(answer) {
    rl.close();
    callback(answer);
  });
}
github teambit / bit / bin / bit-updates.js View on Github external
function _askUser(cb) {
  const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout });
  rl.question('\u001b[1;36mThere is a new version of Bit, would you like to update? [Y/n]: \u001b[0m', function (
    answer
  ) {
    cb(answer === 'y' || answer === 'Y');
    rl.close();
  });
}
github wojtkowiak / meteor-desktop / devEnvSetup.js View on Github external
function question(question) {
    rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    return new Promise(function(resolve, reject) {
        rl.question(question, (answer) => {
            rl.close();
            resolve(answer);
        });
    });
}
github bchr02 / instantclient / instantclient.js View on Github external
var rl_open = function(){
	rl = Readline.createInterface({
		input: process.stdin,
		output: process.stdout
	});
};
github angular / blocking-proxy / spec / e2e / logging_spec.ts View on Github external
function readLog(): Promise {
    const rl = readline.createInterface({input: fs.createReadStream(logPath())});
    let lines = [];
    rl.on('line', (line) => {
      lines.push(line);
    });
    return new Promise((resolve) => {
      rl.on('close', () => {
        resolve(lines);
      });
    });
  }
github Bit-Nation / BITNATION-Pangea-mobile / scripts / android / android-helper.js View on Github external
async function blockReadLine() {
    process.stdin.setRawMode(false);
    let result = undefined;
    var rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout,
        terminal: false
    });
    rl.on('data', function(line){
        result = line;
    })
    
    while(!result) await sleep(100);
    return result;
}
github takuyaa / mecab-ipadic-seed / src / DictionaryReader.js View on Github external
return new Promise((resolve) => {
            const rl = readline.createInterface({
                input: fs.createReadStream(`${__dirname}/dict/${this.filename}`)
            });
            rl.on('line', (line) => {
                callback(line);
            });
            rl.on('close', () => {
                resolve();
            });
        });
    }
github plasma-umass / browsix / src / bin / tail.ts View on Github external
current.on('readable', function(): void {
		let rl = readline.createInterface({
			input: current,
			output: null
		});

		rl.on('line', (line: string) => {
			n++;
			linebuffer.push(line);
			if (n > numlines) {
				linebuffer.shift();
			}
		});
	});

readline

Simple streaming readline module.

BSD
Latest version published 8 years ago

Package Health Score

62 / 100
Full package analysis