askcharacter
Prompt for a single character
Last updated 5 years ago by addaleax .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install askcharacter 
SYNC missed versions from official npm registry.

askcharacter

Prompt for a single character

import askcharacter from 'askcharacter';

console.log('Please enter a character:');
const char = await askcharacter(process.stdin);
console.log('You entered the following askcharacter:', char.toString());

The stream passed to askcharacter can be any kind of Readable stream. If it is a TTY, askcharacter will temporarily remove all other 'data' and 'readable' listeners from it, and set the TTY into raw mode if it has not been in raw mode to begin with.

Why not use read instead?

Because readdoes not work inside a Node.js REPL.

LICENSE

Apache-2.0

Current Tags

  • 1.0.0                                ...           latest (5 years ago)

1 Versions

  • 1.0.0                                ...           5 years ago

Copyright 2013 - present © cnpmjs.org | Home |