advent-of-code-client
Version:
A NodeJS client for fetching inputs, running puzzle challenges and submitting answers to Advent Of Code directly from your JavaScript code.
15 lines (11 loc) • 334 B
text/typescript
import readline from 'readline';
const rl = readline.createInterface(process.stdin, process.stdout);
const waitForUserInput = async (): Promise<string> =>
new Promise((resolve) => {
rl.prompt(true);
rl.on('line', (input: string) => {
rl.pause();
resolve(input);
});
});
export default waitForUserInput;