Skip to content

Ghamza-Jd/stdin-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stdin-js

A library that provide a python like input function. Its async so it should be used within an async context.

Example usage

import { stdinput } from "stdinput-js";
// or
const { stdinput } = require("stdinput-js");

async function main() {
    const name = await stdinput("What's your name?");
    console.log(`Hello, ${name}`);
}

main();

Why?

To teach JavaScript like any other programming language out there you will use stdin sooner or later.

Who would want to take input like this?

var readline = require('readline');

var rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

rl.question("What's your name?  ", function(answer) {
   console.log("Hello " + answer);
   rl.close();
});

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published