Core ModulesLesson 35Free preview
Readline Module
This lesson is part of Node.js · All levels
Summary
The readline module allows reading line by line inputs from streams such as stdin, terminals, or files. You can build an interactive prompt, a CLI menu, or read a large file per line without loading it all into memory. The module also provides events and methods to close the interface neatly.
Key points
- Readline.createInterface creates an interface to read input
- The event line is triggered every time a user presses Enter
- Interface can be read from process.stdin or stream files
- Use close() or event close to close the interface
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.