Skip to main content

Function: createInterface()

createInterface(options): ReadlineInterface

Create a new readline interface.

Parameters

options

InterfaceOptions

Configuration options.

Returns

ReadlineInterface

Example

import { createInterface } from 'tjs:readline';

const rl = createInterface({
input: tjs.stdin,
output: tjs.stdout,
prompt: '> ',
});

for await (const line of rl) {
rl.write(`You said: ${line}\n`);
}

rl.close();