'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 개체의 인스턴스를 로그인 할 때 그러나, 나는 어디 방법 '에'보이지 않는 :
{ 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] }
내가 lineReader.on()를 호출 할 때, 자연스럽게, 내가 오류를 그 기능은 존재하지 않는다고 말했습니다.
설명서를 정확하게 따르고 있습니다 ... 무엇이 누락 되었습니까? 온 방법은 어디에 있습니까?
미리 감사드립니다. 당신이 an example with context을 찾을 때까지
설명해 주셔서 감사합니다. – SemperCallide