You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

askline

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

askline

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

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
2
-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

input

FAQs

Package last updated on 12 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts