Skip to main content
Interface.prototype.write - node__readline.d.ts - Node documentation
method Interface.prototype.write

Usage in Deno

```typescript import { Interface } from "node:node__readline.d.ts"; ```
Interface.prototype.write(
data: string | Buffer,
key?: Key,
): void
The `rl.write()` method will write either `data` or a key sequence identified by `key` to the `output`. The `key` argument is supported only if `output` is a `TTY` text terminal. See `TTY keybindings` for a list of key combinations. If `key` is specified, `data` is ignored. When called, `rl.write()` will resume the `input` stream if it has been paused. If the `Interface` was created with `output` set to `null` or `undefined` the `data` and `key` are not written. ```js rl.write('Delete this!'); // Simulate Ctrl+U to delete the line written previously rl.write(null, { ctrl: true, name: 'u' }); ``` The `rl.write()` method will write the data to the `readline` `Interface`'s `input` _as if it were provided by the user_.

Parameters

data: string | Buffer
optional
key: Key

Return Type

void
Interface.prototype.write(
data:
undefined
| null
| string
| Buffer
,
key: Key,
): void

Parameters

data:
undefined
| null
| string
| Buffer
key: Key

Return Type

void