# caique/terminal

> Every export of caique/terminal, with its signature and doc comment: createIo, streamsOf, plus 1 type.

Source: https://caique.interlace.tools/docs/api/terminal

<!-- Generated by scripts/api-reference.ts from the built dist/*.d.ts. Do not edit; run `npx tsx scripts/api-reference.ts`. -->

```ts
import { createIo, streamsOf } from 'caique/terminal';
```

## Functions

### createIo

A reader and writer over a real stream pair.

The reader resolves `undefined` when the stream ends, which `ask()` reads as a
cancellation — `Ctrl-D` and a closed pipe both arrive that way, and both mean nobody is
going to type.

With no argument it builds over the real process, read when it is called and not at
import: a program that wants the terminal it was started in writes `createIo()`.

```ts
function createIo(streams?: Streams): Io & {
    close: () => void;
};
```

| Parameter | Type |
| :-- | :-- |
| `streams` (optional) | `Streams` |

**Returns** `Io & { close: () => void; }`

## Constants

### streamsOf

A runtime's two streams as the pair `createIo` takes — the mapping, written down once.

```ts
const streamsOf: (runtime: Runtime) => Streams;
```

## Interfaces

### Streams

The stream pair a terminal Io is built over: a `Runtime`'s `stdin` and its `stdout`.

```ts
interface Streams {
    input: NodeJS.ReadableStream & {
        isTTY?: boolean;
    };
    output: NodeJS.WritableStream & {
        isTTY?: boolean;
        columns?: number;
    };
}
```
