Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
async/await 標準入力読み込み
process.stdin.resume();
process.stdin.setEncoding('utf8');
// Here your code !
function getStdin() {
return new Promise((resolve, reject) => {
let input_string = '';
process.stdin.on('data', function(chunk) {
input_string += chunk;
});
process.stdin.on('end', function() {
resolve(input_string);
});
});
}
async function main() {
let input_string = await getStdin();
console.log(input_string);
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment