You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
331 B
14 lines
331 B
3 years ago
|
(async () => {
|
||
|
for await (const chunk of process.stdin) {
|
||
|
const letters = chunk.toString("utf8").split("");
|
||
|
for (const letter of letters) {
|
||
|
process.stdout.write(letter);
|
||
|
await sleep(Math.random() * 100 + 20);
|
||
|
}
|
||
|
}
|
||
|
})();
|
||
|
|
||
|
function sleep(ms) {
|
||
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
||
|
}
|