Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

mongodb-js/askline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

askline

A single-line prompt that allows reading data from user input.

import askline from 'askline';

console.log('Please enter a something:');
const result = await askline({ input: process.stdin, output: process.stdout });
console.log('You entered the following password:', result.toString());

The stream passed to askline can be any kind of Readable stream. If it is a TTY, askline 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 read does not work inside a Node.js REPL.

LICENSE

Apache-2.0

About

A single-line prompt that allows reading data from user input

Resources

License

Stars

Watchers

Forks

Packages

No packages published