3 For reading user input from stdin.
5 Similar to the `readline` builtin's `question()` method, but with a
11 var read = require("read")
12 read(options, callback)
15 The callback gets called with either the user input, or the default
16 specified, or an error, as `callback(error, result, isDefault)`
21 Every option is optional.
23 * `prompt` What to write to stdout before reading input.
24 * `silent` Don't echo the output as the user types it.
25 * `replace` Replace silenced characters with the supplied character value.
26 * `timeout` Number of ms to wait for user input before giving up.
27 * `default` The default value if the user enters nothing.
28 * `edit` Allow the user to edit the default value.
29 * `terminal` Treat the output as a TTY, whether it is or not.
30 * `input` Readable stream to get input data from. (default `process.stdin`)
31 * `output` Writeable stream to write prompts to. (default: `process.stdout`)
33 If silent is true, and the input is a TTY, then read will set raw
34 mode, and read character by character.
38 This module works sort of with node 0.6. It does not work with node
39 versions less than 0.6. It is best on node 0.8.
41 On node version 0.6, it will remove all listeners on the input
42 stream's `data` and `keypress` events, because the readline module did
43 not fully clean up after itself in that version of node, and did not
44 make it possible to clean up after it in a way that has no potential
47 Additionally, some of the readline options (like `terminal`) will not
48 function in versions of node before 0.8, because they were not
49 implemented in the builtin readline module.