interface · Browser and Node

# WebSerialPortLike

The parts of a Web Serial `SerialPort` we use.

`@toip-tools/mesh-transport/serial` · [View source](https://github.com/yourbuddyconner/toip-tools/blob/main/packages/mesh-transport/src/serial.ts#L15)

Import:

```ts
import { type WebSerialPortLike } from "@toip-tools/mesh-transport/serial";
```

## Declaration

interface:

```ts
interface WebSerialPortLike {
  open(options: { baudRate: number }): Promise<void>;
  close(): Promise<void>;
  readonly readable: ReadableStream<Uint8Array> | null;
  readonly writable: WritableStream<Uint8Array> | null;
  getInfo?(): { usbVendorId?: number; usbProductId?: number };
}
```

## Properties

- **`readable` (required · readonly)**: `ReadableStream<Uint8Array<ArrayBufferLike>> | null`
- **`writable` (required · readonly)**: `WritableStream<Uint8Array<ArrayBufferLike>> | null`
- **`getInfo` (optional)**: `(() => { usbVendorId?: number; usbProductId?: number; }) | undefined`

## Methods

### `open`

Signature:

```ts
open(options: {
    baudRate: number;
}): Promise<void>;
```

#### Parameters

**`options` (required)**

`{ baudRate: number; }`

**Fields of `options`**

- **`baudRate` (required)**: `number`

#### Returns

`Promise<void>`

### `close`

Signature:

```ts
close(): Promise<void>;
```

No parameters.

#### Returns

`Promise<void>`

[Usage guide](https://toip.tools/toolkit/mesh-transport/#usage) · [Error handling](https://toip.tools/toolkit/mesh-transport/#errors) · [All exports](https://toip.tools/toolkit/mesh-transport/api/serial/)

---

This is the Markdown version of https://toip.tools/toolkit/mesh-transport/api/serial/WebSerialPortLike/. An index of the documentation for AI assistants is at https://toip.tools/llms.txt.
