Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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);
})
});
}
function ask(question, callback) {
var rl = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
rl.question(question, function(answer) {
rl.close();
callback(answer);
});
}
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();
});
}
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);
});
});
}
var rl_open = function(){
rl = Readline.createInterface({
input: process.stdin,
output: process.stdout
});
};
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);
});
});
}
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;
}
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();
});
});
}
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();
}
});
});