Socket
Socket
Sign inDemoInstall

ask-readline

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ask-readline

Ask a question for CLI using readline, supports muted input


Version published
Maintainers
1
Created

Readme

Source

ask-readline

Ask a question for CLI using readline, supports muted input

npm i ask-readline

Usage

const ask = require('ask-readline')

main()

async function main () {
  const username = await ask('Input username (clear): ', { clear: true })
  const password = await ask('Input password (clear and muted): ', { clear: true, muted: true })
  const twoFactorAuth = await ask('Input 2fa (keep but muted): ', { clear: false, muted: true })
  const alias = await ask('Input alias (default): ')

  console.log({ username, password, twoFactorAuth, alias })
}

API

const answer = await ask(question, [options])

answer is a string or null.
If user does CTRL+C then answer is null.

Available options:

{
  clear: false,
  muted: false
}

clear removes the line where the question was printed.
muted ensures that input is hidden, and not written to stdout.

License

MIT

FAQs

Last updated on 04 May 2023

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc