Skip to content

bhowmikrishav/npm_module_inputsync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

npm_module_inputsync

npm package to take command line inputs with Promise return

How to install

$ npm i inputsync

npm package link

How to use

Include npm Package inputsync in you JS file

const InputSync = require("inputsync");

To take command line input

Using await

const name = await InputSync.getline("Your Name : ")
console.log( "Your name is : " + name )

//best practice with error handling
try{
  const name_withoutErr = await InputSync.getline("Your Name : ")
  //if no error in line above
  console.log( "Your name is : " + name_withoutErr )
}catch(e){
  console.error(e)
}

Using Promise.prototype.then()

InputSync.getline("Your favorite city : ").then( (input) => {
  console.log( "Your favorite city : " + input )
}, (err) => {
  console.error(err) //incase error is returned
})

Functions in the package

InputSync.getline(question)

question string

Returns Promise

How to Contribute

Email me at : [email protected]

Subject : Contribute to npm package inputsync

Body : Describe why & how would you like you contribute

About

npm package to take command line inputs with Promise return

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published