# react-native-usbserial

> An USB Serial driver for react-native

Latest version **1.0.1** (published 2017-08-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-usbserial
pnpm add react-native-usbserial
yarn add react-native-usbserial
bun add react-native-usbserial
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-08-23 |
| First published | 2017-03-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 58 |
| Author | Matheus Paiva |
| Maintainers | mapaiva |
| Keywords | react-native, usb, serial, usbserial |

## Links

- npm: https://www.npmjs.com/package/react-native-usbserial
- Repository: https://github.com/mapaiva/react-native-usbserial
- Homepage: https://github.com/mapaiva/react-native-usbserial#readme
- Issues: https://github.com/mapaiva/react-native-usbserial/issues
- npm.io page: https://npm.io/package/react-native-usbserial

## Recent versions

- 1.0.1 (latest) — 2017-08-23
- 1.0.0 — 2017-03-01

## README

# react-native-usbserial

This wrapper implementation is totally based on [usb-serial-for-android](https://github.com/mik3y/usb-serial-for-android). Thanks [mik3y](https://github.com/mik3y) for the awesome project.

## Installation

```
npm install react-native-usbserial --save
```

## Integrate module

To integrate `react-native-usbserial` with the rest of your react app just execute:
```
react-native link react-native-usbserial
```

### Android

To integrate it with your android application you also need to add these following lines on your `android/app/build.gradle`:

```gradle
repositories {
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
```

## Usage

```javascript
import { UsbSerial} from 'react-native-usbserial';

const usbs = new UsbSerial();

async function getDeviceAsync() {

    try {
        const deviceList = await usbs.getDeviceListAsync();
        const firstDevice = deviceList[0];
        
        console.log(firstDevice);

        if (firstDevice) {
            const usbSerialDevice = await usbs.openDeviceAsync(firstDevice);
            
            console.log(usbSerialDevice);
        }
    } catch (err) {
        console.warn(err);
    }
}

getDeviceAsync();
```

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