Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

wait-for-user-input

NPM

minimal way to wait for user input on the terminal.

handles single character user input. (y/n)

async main () {
  const input = await waitForUserInput('do you agree?')
  ...
}

installation

npm i wait-for-user-input

usage

async / await

const waitForUserInput = require('wait-for-user-input')

main()

async function main () {
  const userInput = await waitForUserInput('')
  // handle user input
}

promises

const waitForUserInput = require('wait-for-user-input')

waitForUserInput('')
.then(userInput => {
  // handle user input
})

About

minimal way to wait for user input on the terminal.

Resources

Packages

No packages published