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

@simplysm/capacitor-plugin-usb-storage

v13.0.75

Published

Simplysm Package - Capacitor USB Storage Plugin

Downloads

9,915

Readme

@simplysm/capacitor-plugin-usb-storage

Simplysm Package - Capacitor USB Storage Plugin

Provides access to USB Mass Storage devices from a Capacitor application.

  • Android: USB Mass Storage access via the libaums library.
  • Browser: IndexedDB-based virtual USB storage emulation for development.

Installation

pnpm add @simplysm/capacitor-plugin-usb-storage

Main Modules

UsbStorage

An abstract class that exposes static methods for interacting with USB storage devices.

import { UsbStorage } from "@simplysm/capacitor-plugin-usb-storage";

UsbStorage.getDevices()

Returns a list of currently connected USB devices.

static async getDevices(): Promise<IUsbDeviceInfo[]>
const devices = await UsbStorage.getDevices();
for (const device of devices) {
  console.log(device.productName, device.vendorId, device.productId);
}

UsbStorage.requestPermission(filter)

Requests access permission for a specific USB device identified by its vendor and product IDs.

static async requestPermission(filter: IUsbDeviceFilter): Promise<boolean>
const granted = await UsbStorage.requestPermission({ vendorId: 0x1234, productId: 0x5678 });
if (granted) {
  console.log("Permission granted");
}

UsbStorage.hasPermission(filter)

Checks whether access permission for a specific USB device is currently held.

static async hasPermission(filter: IUsbDeviceFilter): Promise<boolean>
const alreadyGranted = await UsbStorage.hasPermission({ vendorId: 0x1234, productId: 0x5678 });

UsbStorage.readdir(filter, dirPath)

Reads the contents of a directory on the USB storage device.

static async readdir(filter: IUsbDeviceFilter, dirPath: string): Promise<IUsbFileInfo[]>
const filter = { vendorId: 0x1234, productId: 0x5678 };
const entries = await UsbStorage.readdir(filter, "/");
for (const entry of entries) {
  console.log(entry.name, entry.isDirectory ? "(dir)" : "(file)");
}

UsbStorage.read(filter, filePath)

Reads a file from the USB storage device and returns its contents as Bytes. Returns undefined if the file does not exist.

static async read(filter: IUsbDeviceFilter, filePath: string): Promise<Bytes | undefined>
const filter = { vendorId: 0x1234, productId: 0x5678 };
const bytes = await UsbStorage.read(filter, "/data/file.bin");
if (bytes !== undefined) {
  console.log("File size:", bytes.length);
}

Types

import type {
  IUsbDeviceInfo,
  IUsbDeviceFilter,
  IUsbFileInfo,
  IUsbStoragePlugin,
} from "@simplysm/capacitor-plugin-usb-storage";

IUsbDeviceInfo

Describes a connected USB device.

interface IUsbDeviceInfo {
  deviceName: string;
  manufacturerName: string;
  productName: string;
  vendorId: number;
  productId: number;
}

IUsbDeviceFilter

Identifies a USB device by its vendor and product IDs. Used as a selector in permission and file-system calls.

interface IUsbDeviceFilter {
  vendorId: number;
  productId: number;
}

IUsbFileInfo

Describes a single entry (file or directory) returned by readdir.

interface IUsbFileInfo {
  name: string;
  isDirectory: boolean;
}

IUsbStoragePlugin

The raw Capacitor plugin interface registered under the "UsbStorage" plugin name. Prefer using the UsbStorage abstract class instead of calling this interface directly.

interface IUsbStoragePlugin {
  getDevices(): Promise<{ devices: IUsbDeviceInfo[] }>;
  requestPermission(options: IUsbDeviceFilter): Promise<{ granted: boolean }>;
  hasPermission(options: IUsbDeviceFilter): Promise<{ granted: boolean }>;
  readdir(options: IUsbDeviceFilter & { path: string }): Promise<{ files: IUsbFileInfo[] }>;
  read(options: IUsbDeviceFilter & { path: string }): Promise<{ data: string | null }>;
}