# br_usb

> usb

Latest version **0.0.5** (published 2023-07-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install br_usb
pnpm add br_usb
yarn add br_usb
bun add br_usb
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2023-07-03 |
| First published | 2023-07-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 56.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | br_carry |
| Keywords | capacitor, plugin, native |

## Links

- npm: https://www.npmjs.com/package/br_usb
- Repository: https://github.com/br/user
- Homepage: https://github.com/br/user#readme
- Issues: https://github.com/br/user/issues
- npm.io page: https://npm.io/package/br_usb

## Recent versions

- 0.0.5 (latest) — 2023-07-03
- 0.0.4 — 2023-07-03
- 0.0.3 — 2023-07-03
- 0.0.2 — 2023-07-03
- 0.0.1 — 2023-07-03

## README

# usb

usb

## Install

```bash
npm install usb
npx cap sync
```

## API

<docgen-index>

* [`echo(...)`](#echo)
* [`registerUsbAttachedDetachedCallback(...)`](#registerusbattacheddetachedcallback)
* [`devices()`](#devices)
* [`open(...)`](#open)
* [`close()`](#close)
* [`read()`](#read)
* [`write(...)`](#write)
* [`registerReadCallback(...)`](#registerreadcallback)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)

</docgen-index>

<docgen-api>
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->

### echo(...)

```typescript
echo(options: { value: string; }) => Promise<{ value: string; }>
```

| Param         | Type                            |
| ------------- | ------------------------------- |
| **`options`** | <code>{ value: string; }</code> |

**Returns:** <code>Promise&lt;{ value: string; }&gt;</code>

--------------------


### registerUsbAttachedDetachedCallback(...)

```typescript
registerUsbAttachedDetachedCallback(callback: UsbAttachedDetachedCallback) => Promise<CallbackID>
```

| Param          | Type                                                                                |
| -------------- | ----------------------------------------------------------------------------------- |
| **`callback`** | <code><a href="#usbattacheddetachedcallback">UsbAttachedDetachedCallback</a></code> |

**Returns:** <code>Promise&lt;string&gt;</code>

--------------------


### devices()

```typescript
devices() => Promise<UsbResponse<any>>
```

**Returns:** <code>Promise&lt;<a href="#usbresponse">UsbResponse</a>&lt;any&gt;&gt;</code>

--------------------


### open(...)

```typescript
open(options: SerialOptions) => Promise<UsbResponse<any>>
```

| Param         | Type                                                    |
| ------------- | ------------------------------------------------------- |
| **`options`** | <code><a href="#serialoptions">SerialOptions</a></code> |

**Returns:** <code>Promise&lt;<a href="#usbresponse">UsbResponse</a>&lt;any&gt;&gt;</code>

--------------------


### close()

```typescript
close() => Promise<UsbResponse<any>>
```

**Returns:** <code>Promise&lt;<a href="#usbresponse">UsbResponse</a>&lt;any&gt;&gt;</code>

--------------------


### read()

```typescript
read() => Promise<UsbResponse<any>>
```

**Returns:** <code>Promise&lt;<a href="#usbresponse">UsbResponse</a>&lt;any&gt;&gt;</code>

--------------------


### write(...)

```typescript
write(data: SerialWriteOptions) => Promise<UsbResponse<any>>
```

| Param      | Type                                                              |
| ---------- | ----------------------------------------------------------------- |
| **`data`** | <code><a href="#serialwriteoptions">SerialWriteOptions</a></code> |

**Returns:** <code>Promise&lt;<a href="#usbresponse">UsbResponse</a>&lt;any&gt;&gt;</code>

--------------------


### registerReadCallback(...)

```typescript
registerReadCallback(callback: ReadCallback) => Promise<CallbackID>
```

| Param          | Type                                                  |
| -------------- | ----------------------------------------------------- |
| **`callback`** | <code><a href="#readcallback">ReadCallback</a></code> |

**Returns:** <code>Promise&lt;string&gt;</code>

--------------------


### Interfaces


#### UsbResponse

| Prop          | Type                                                |
| ------------- | --------------------------------------------------- |
| **`success`** | <code>boolean</code>                                |
| **`error`**   | <code><a href="#serialerror">SerialError</a></code> |
| **`data`**    | <code>T</code>                                      |


#### SerialError

| Prop          | Type                |
| ------------- | ------------------- |
| **`message`** | <code>string</code> |
| **`cause`**   | <code>string</code> |


#### SerialOptions

| Prop               | Type                 |
| ------------------ | -------------------- |
| **`deviceId`**     | <code>number</code>  |
| **`portNum`**      | <code>number</code>  |
| **`baudRate`**     | <code>number</code>  |
| **`dataBits`**     | <code>number</code>  |
| **`stopBits`**     | <code>number</code>  |
| **`parity`**       | <code>number</code>  |
| **`dtr`**          | <code>boolean</code> |
| **`rts`**          | <code>boolean</code> |
| **`sleepOnPause`** | <code>boolean</code> |


#### SerialWriteOptions

| Prop       | Type                |
| ---------- | ------------------- |
| **`data`** | <code>string</code> |


### Type Aliases


#### UsbAttachedDetachedCallback

<code>(data: <a href="#usbresponse">UsbResponse</a>&lt;any&gt;): void</code>


#### CallbackID

<code>string</code>


#### ReadCallback

<code>(data: <a href="#usbresponse">UsbResponse</a>&lt;any&gt;): void</code>

</docgen-api>

---
_Source: https://npm.io/package/br_usb · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
