...

/

Question the User

Question the User

Learn how to create a feedback-based interface for a user using native modules of Node.

We'll cover the following...

The readline module

Node has a native module, known as readline, which builds upon the standard input (stdin) and standard input (stdout), and provides an interface —or wrapper— between them. It allows you to read one line at a time, which means you can easily prompt and save answers provided by the user. You can test whether or not you can use this module to create a project directory based on the user’s input.

For this example, you will need the file system (fs) module, the readline module, the stdin and stdout from the process object, and the path module.

const fs = require('fs');
const readline =
...