Browse Source

doc refactor: readline

v0.9.1-release
isaacs 13 years ago
parent
commit
728386bfb2
  1. 11
      doc/api/readline.markdown

11
doc/api/readline.markdown

@ -1,4 +1,4 @@
## Readline
# Readline
To use this module, do `require('readline')`. Readline allows reading of a
stream (such as STDIN) on a line-by-line basis.
@ -17,7 +17,7 @@ program to gracefully pause:
i.pause();
});
### rl.createInterface(input, output, completer)
## rl.createInterface(input, output, completer)
Takes two streams and creates a readline interface. The `completer` function
is used for autocompletion. When given a substring, it returns `[[substr1,
@ -35,6 +35,11 @@ Also `completer` can be run in async mode if it accepts two arguments:
var readline = require('readline'),
rl = readline.createInterface(process.stdin, process.stdout);
## Class: Interface
The class that represents a readline interface with a stdin and stdout
stream.
### rl.setPrompt(prompt, length)
Sets the prompt, for example when you run `node` on the command line, you see
@ -48,8 +53,6 @@ options on a new line, giving the user a new spot to write.
This will also resume the `in` stream used with `createInterface` if it has
been paused.
<!-- ### rl.getColumns() Not available? -->
### rl.question(query, callback)
Prepends the prompt with `query` and invokes `callback` with the user's

Loading…
Cancel
Save