npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@eugabrielsilva/capacitor-usb-serial

v0.0.4

Published

Capacitor-USB-Serial is a native plugin for Capacitor that enables communication with USB serial devices on Android and iOS platforms. Seamlessly connect to IoT devices, microcontrollers, and embedded systems to receive real-time data streams directly int

Downloads

581

Readme

capacitor-usb-serial

Capacitor-USB-Serial is a native plugin for Capacitor that enables communication with USB serial devices on Android and iOS platforms. Seamlessly connect to IoT devices, microcontrollers, and embedded systems to receive real-time data streams directly into your cross-platform mobile apps for telemetry monitoring, drone tracking, or hardware integration applications.

Install

npm install capacitor-usb-serial
npx cap sync

API

requestPermission(...)

requestPermission(options?: { deviceId?: number | undefined; } | undefined) => Promise<{ granted: boolean; }>

Request permission to access USB devices

| Param | Type | | ------------- | ----------------------------------- | | options | { deviceId?: number; } |

Returns: Promise<{ granted: boolean; }>


listDevices()

listDevices() => Promise<{ devices: UsbDevice[]; }>

List all connected USB devices

Returns: Promise<{ devices: UsbDevice[]; }>


connect(...)

connect(options: { deviceId?: number; serialOptions?: UsbSerialOptions; }) => Promise<{ connected: boolean; }>

Connect to a USB device

| Param | Type | | ------------- | ----------------------------------------------------------------------------------------------------- | | options | { deviceId?: number; serialOptions?: UsbSerialOptions; } |

Returns: Promise<{ connected: boolean; }>


disconnect()

disconnect() => Promise<{ disconnected: boolean; }>

Disconnect from the current device

Returns: Promise<{ disconnected: boolean; }>


write(...)

write(options: { data: string; }) => Promise<{ bytesWritten: number; }>

Write data to the serial port

| Param | Type | | ------------- | ------------------------------ | | options | { data: string; } |

Returns: Promise<{ bytesWritten: number; }>


read()

read() => Promise<{ data: string; }>

Read data from the serial port

Returns: Promise<{ data: string; }>


startListening()

startListening() => Promise<void>

Start listening for data


stopListening()

stopListening() => Promise<void>

Stop listening for data


addListener('dataReceived', ...)

addListener(eventName: 'dataReceived', listenerFunc: (event: DataReceivedEvent) => void) => Promise<{ remove: () => void; }>

Add listener for data received events

| Param | Type | | ------------------ | ----------------------------------------------------------------------------------- | | eventName | 'dataReceived' | | listenerFunc | (event: DataReceivedEvent) => void |

Returns: Promise<{ remove: () => void; }>


addListener('connectionStateChanged', ...)

addListener(eventName: 'connectionStateChanged', listenerFunc: (event: { connected: boolean; deviceId?: number; }) => void) => Promise<{ remove: () => void; }>

Add listener for connection state changes

| Param | Type | | ------------------ | --------------------------------------------------------------------------- | | eventName | 'connectionStateChanged' | | listenerFunc | (event: { connected: boolean; deviceId?: number; }) => void |

Returns: Promise<{ remove: () => void; }>


addListener('deviceAttached', ...)

addListener(eventName: 'deviceAttached', listenerFunc: (event: DeviceAttachedEvent) => void) => Promise<{ remove: () => void; }>

Add listener for device attached events

| Param | Type | | ------------------ | --------------------------------------------------------------------------------------- | | eventName | 'deviceAttached' | | listenerFunc | (event: DeviceAttachedEvent) => void |

Returns: Promise<{ remove: () => void; }>


addListener('deviceDetached', ...)

addListener(eventName: 'deviceDetached', listenerFunc: (event: DeviceDetachedEvent) => void) => Promise<{ remove: () => void; }>

Add listener for device detached events

| Param | Type | | ------------------ | --------------------------------------------------------------------------------------- | | eventName | 'deviceDetached' | | listenerFunc | (event: DeviceDetachedEvent) => void |

Returns: Promise<{ remove: () => void; }>


addListener('error', ...)

addListener(eventName: 'error', listenerFunc: (event: ErrorEvent) => void) => Promise<{ remove: () => void; }>

Add listener for error events

| Param | Type | | ------------------ | --------------------------------------------------------------------- | | eventName | 'error' | | listenerFunc | (event: ErrorEvent) => void |

Returns: Promise<{ remove: () => void; }>


Interfaces

UsbDevice

| Prop | Type | | ---------------------- | ------------------- | | deviceId | number | | vendorId | number | | productId | number | | deviceName | string | | manufacturerName | string | | serialNumber | string |

UsbSerialOptions

| Prop | Type | | -------------- | ----------------------------------------------------------- | | baudRate | number | | dataBits | number | | stopBits | number | | parity | 'none' | 'odd' | 'even' | 'mark' | 'space' | | dtr | boolean | | rts | boolean | | protocol | string | | host | string | | port | number |

DataReceivedEvent

| Prop | Type | | --------------- | ------------------- | | data | string | | hexData | string | | timestamp | number | | deviceId | number |

DeviceAttachedEvent

| Prop | Type | | ---------------------- | ------------------- | | deviceId | number | | vendorId | number | | productId | number | | deviceName | string | | manufacturerName | string | | serialNumber | string |

DeviceDetachedEvent

| Prop | Type | | -------------- | ------------------- | | deviceId | number |

ErrorEvent

| Prop | Type | | ------------- | ------------------- | | message | string |