| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1808572 commit b3ea8f1
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,7 +16,20 @@ const readline = require('readline'); | |||
| 16 | 16 | ||
| 17 | 17 | The following simple example illustrates the basic use of the `readline` module. | |
| 18 | 18 | ||
| 19 | - ```js | ||
| 19 | + ```mjs | ||
| 20 | + import * as readline from 'node:readline/promises'; | ||
| 21 | + import { stdin as input, stdout as output } from 'node:process'; | ||
| 22 | + | ||
| 23 | + const rl = readline.createInterface({ input, output }); | ||
| 24 | + | ||
| 25 | + const answer = await rl.question('What do you think of Node.js? '); | ||
| 26 | + | ||
| 27 | + console.log(`Thank you for your valuable feedback: ${answer}`); | ||
| 28 | + | ||
| 29 | + rl.close(); | ||
| 30 | + ``` | ||
| 31 | + | ||
| 32 | + ```cjs | ||
| 20 | 33 | const readline = require('readline'); | |
| 21 | 34 | ||
| 22 | 35 | const rl = readline.createInterface({ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments