Skip to main content
Deno 2 is finally here 🎉️
Learn more

Deno keypress reader

Reads key from stdin.

Try

deno run --unstable test.ts

Usage

import {readKeypress} from "./mod.ts";

while (true) {
    const events = await readKeypress();

    events.forEach(event => {
        console.log(event);

        if (event.ctrlKey && event.key === 'c') {
            Deno.exit(0);
        }
    })
}