read
read(1) for node programs
Last updated 10 years ago by isaacs .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install read 
SYNC missed versions from official npm registry.

read

For reading user input from stdin.

Similar to the readline builtin's question() method, but with a few more features.

Usage

var read = require("read")
try {
  const result = await read(options, callback)
} catch (er) {
  console.error(er)
}

Options

Every option is optional.

  • prompt What to write to stdout before reading input.
  • silent Don't echo the output as the user types it.
  • replace Replace silenced characters with the supplied character value.
  • timeout Number of ms to wait for user input before giving up.
  • default The default value if the user enters nothing.
  • edit Allow the user to edit the default value.
  • terminal Treat the output as a TTY, whether it is or not.
  • input Readable stream to get input data from. (default process.stdin)
  • output Writable stream to write prompts to. (default: process.stdout)
  • completer Autocomplete callback (see official api for details

If silent is true, and the input is a TTY, then read will set raw mode, and read character by character.

Contributing

Patches welcome.

Current Tags

  • 2.1.0                                ...           latest (2 years ago)

15 Versions

  • 2.1.0                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.0.7                                ...           9 years ago
  • 1.0.6                                ...           10 years ago
  • 1.0.5                                ...           11 years ago
  • 1.0.4                                ...           12 years ago
  • 1.0.3                                ...           12 years ago
  • 1.0.2                                ...           12 years ago
  • 1.0.1                                ...           12 years ago
  • 1.0.0                                ...           12 years ago
  • 0.1.1                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
  • 0.0.3                                ...           12 years ago
  • 0.0.2                                ...           13 years ago
  • 0.0.1                                ...           13 years ago
Downloads
Today 1
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (1)

Copyright 2013 - present © cnpmjs.org | Home |