Collecting input is made easy with Node.js's readline module. Readline is a core module that was installed with Node.js. With readline, you can ask a user questions in the terminal and collect their answers. In this video, learn how to build a readline app that will prompt the user to answer an ongoing list of questions.
- [Instructor] Readline is the module…that we can use to help us build an application…that would ask questions of a terminal user.…It's an interface around readable and writable…streams that allows us to easily write code…that would prompt the user and collect their answers.…Let's take a look at using the readline module.…I'm going to go ahead and add another file…to the directory here and I'm going to call it ask dot JS.…And within this file we'll first load…the readline module using the require function.…And readline is one of those core modules…that's available to you without having to install…anything other than node JS.…
In order to work with readline we must create…an interface.…So I'm going to create a variable called RL…that we will use as our readline interface.…And I can call readline dot create interface.…So within the create interface function…we need to supply an object that tells readline…what stream to use for input and what stream…to use for output.…We're going to use process dot std in for input…
- What is Node.js?
- Installing Node.js
- The global object
- Importing the core modules
- Creating custom events with the EventEmitter
- Reading, writing, and removing files
- Working with file streams
- Creating child processes with the exec and spawn functions
Skill Level Intermediate
Node.js: Real-Time Web with Socket.IOwith Emmanuel Henri1h 24m Intermediate
1. What Is Node.js?
2. Set Up Your Environnment
3. Node Globals
4. Node Modules
5. File System Basics
6. Files and Streams
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.