lib-curses
Version:
Simple node.js library for work with console
18 lines (17 loc) • 536 B
TypeScript
/**
* Reads a single key press from standard input and returns it as a buffer.
*
* This function enables raw mode for standard input, allowing it to capture
* key presses immediately without waiting for Enter key to be pressed.
*
* @async
* @function getch
* @returns {Promise<Buffer>} A promise that resolves with a buffer containing pressed key.
*
* @example
* (async () => {
* const key = await getch();
* console.log(`You pressed: ${key.toString()}`);
* })();
*/
export declare function getch(): Promise<Buffer>;