engineer-man / piston

A high performance general purpose code execution engine.
https://emkc.org/run
MIT License
1.82k stars 226 forks source link

No proper way of taking process.stdin input using JavaScript? #670

Open Omar-Walid-MD opened 1 month ago

Omar-Walid-MD commented 1 month ago

Functions like prompt() and readLine() aren't defined and their packages cannot be imported. Is there a way to read input using JavaScript?

Brikaa commented 1 month ago

You need to use the NodeJS ways of getting the stdin like process.stdin image

Omar-Walid-MD commented 1 month ago

Thanks. Is there any way it can be used in a function that works in a similar way to python's input? Something like "const n = input()"

Brikaa commented 1 month ago

There are multiple ways to read from stdin in NodeJS. You can use ones that don't require external NPM modules.