私は 'readline'モジュールを使って行ごとにテキストファイルを読み込んでコンソールに出力するノードアプリケーションを作成しようとしています。ノードreadlineモジュールに 'on'機能がありませんか?
var lineReader = require('readline');
lineReader.createInterface({
input: fs.createReadStream('./testfile')
});
lineReader.on('line', function(line){
console.log(line);
});
there should be an 'on' methodによると、しかし、私は私が作成したreadlineのオブジェクトのインスタンスをログインしたときに、私はどこかの方法「on」に表示されていない:私はlineReader.on()を呼び出すとき
{ createInterface: [Function], Interface: { [Function: Interface]
super_:
{ [Function: EventEmitter]
EventEmitter: [Circular],
usingDomains: false,
defaultMaxListeners: [Getter/Setter],
init: [Function],
listenerCount: [Function] } },
emitKeypressEvents: [Function: emitKeypressEvents],
cursorTo: [Function: cursorTo],
moveCursor: [Function: moveCursor],
clearLine: [Function: clearLine],
clearScreenDown: [Function: clearScreenDown],
codePointAt: [Function: deprecated],
getStringWidth: [Function: deprecated],
isFullWidthCodePoint: [Function: deprecated],
stripVTControlCharacters: [Function: deprecated] }
だから、当然、私はエラーを取得しますその機能は存在しないと言っています。
私はドキュメントに正確に従っています...何が欠けていますか?オンメソッドはどこですか?
お時間をいただきありがとうございます。あなたがan example with contextを見つけるまで
ありがとうございます – SemperCallide