blob: 87502e7d9f05e1a3bfd02f018c3c39d5411daa35 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
Deno.setRaw(0, true);
Deno.setRaw(0, true); // Can be called multiple times
Deno.stdout.writeSync(new TextEncoder().encode("S"));
const buf = new Uint8Array(3);
for (let i = 0; i < 3; i++) {
const nread = await Deno.stdin.read(buf);
if (nread === null) {
break;
} else {
const data = new TextDecoder().decode(buf.subarray(0, nread));
Deno.stdout.writeSync(new TextEncoder().encode(data.toUpperCase()));
}
}
Deno.setRaw(0, false); // restores old mode.
Deno.setRaw(0, false); // Can be safely called multiple times
|