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

expo-micro-ide

v1.2.3

Published

A clean and type-safe Expo native module for interacting with microcontroller boards in React Native applications

Readme

ExpoMicroIde

A powerful Expo native module for interacting with microcontroller boards in React Native applications. This module provides a clean and type-safe interface for file system operations and board control.

Features

  • 🔌 Easy board connection and initialization
  • 📁 Complete file system operations (read, write, list, create, delete, rename)
  • ⚡ Script execution and control (run, pause, reset)
  • 📊 Real-time status monitoring
  • 🔒 Type-safe API with TypeScript support
  • 🎯 Clean architecture design

Installation

npm install expo-micro-ide
# or
yarn add expo-micro-ide

Quick Start

import { board, files } from 'expo-micro-ide';

// Initialize connection
await board.initialize();

// List files in root directory
const fileList = await files.list('/');

// Create and write to a file
await files.create('main.py');
await files.write('/main.py', 'print("Hello from MicroPython!")');

// Execute the script
await board.run();

// Monitor board status
board.onStatusChange((status) => {
  console.log('Board status:', status);
});

API Reference

File System Operations

The files object provides the following methods:

list(path?: string): Promise<MicroFile[]>

Lists files in the specified directory.

  • path: Optional directory path (defaults to root)
  • Returns: Array of MicroFile objects

create(name: string, path?: string): Promise<string>

Creates a new file.

  • name: Name of the file to create
  • path: Optional directory path
  • Returns: Success message

remove(fileName: string, path?: string): Promise<string>

Deletes a file.

  • fileName: Name of the file to delete
  • path: Optional directory path
  • Returns: Success message

rename(oldName: string, newName: string, path?: string): Promise<string>

Renames a file.

  • oldName: Current file name
  • newName: New file name
  • path: Optional directory path
  • Returns: Success message

read(path: string): Promise<string>

Reads file contents.

  • path: Full path to the file
  • Returns: File contents as string

write(path: string, content: string): Promise<string>

Writes content to a file.

  • path: Full path to the file
  • content: Content to write
  • Returns: Success message

Board Control

The board object provides the following methods:

initialize(): Promise<string>

Initializes connection with the board.

  • Returns: Board identification string

run(script?: string): Promise<string>

Executes a Python script.

  • script: Optional script content (defaults to main.py)
  • Returns: Execution result

pause(): Promise<string>

Pauses current script execution.

  • Returns: Success message

reset(): Promise<string>

Resets the board.

  • Returns: Success message

getLastOutput(): string

Gets the last execution output.

  • Returns: Last output or error message

getConnectionStatus(): ConnectionStatus

Gets current connection status.

  • Returns: ConnectionStatus enum value

getBoardStatus(): BoardStatus

Gets current board execution status.

  • Returns: BoardStatus enum value

Event Listeners

board.onStatusChange(callback: (status: BoardStatus) => void): () => void

Subscribe to board status changes.

  • Returns: Unsubscribe function

board.onConnectionChange(callback: (status: ConnectionStatus) => void): () => void

Subscribe to connection status changes.

  • Returns: Unsubscribe function

Types

enum BoardStatus {
  RUNNING = "Running",
  PAUSED = "Paused",
  STOPPED = "Stopped",
  ERROR = "Error"
}

enum ConnectionStatus {
  CONNECTED = "Connected",
  CONNECTING = "Connecting",
  ERROR = "Error",
  DISCONNECTED = "Disconnected"
}

interface MicroFile {
  name: string;
  path: string;
  size: number;
  type: FileType;
  modifiedAt?: Date;
}

enum FileType {
  FILE = 0,
  DIRECTORY = 1
}

Error Handling

The module uses a consistent error handling approach. All async operations may throw errors with the following types:

enum ErrorType {
  CONNECTION_ERROR = "CONNECTION_ERROR",
  FILE_SYSTEM_ERROR = "FILE_SYSTEM_ERROR",
  EXECUTION_ERROR = "EXECUTION_ERROR",
  PERMISSION_ERROR = "PERMISSION_ERROR",
  DEVICE_ERROR = "DEVICE_ERROR"
}

Example error handling:

try {
  await board.initialize();
    } catch (error) {
  if (error.code === ErrorType.CONNECTION_ERROR) {
    console.error('Connection failed:', error.message);
    }
  }

Best Practices

  1. Always initialize the board before performing any operations:
await board.initialize();
  1. Use the event listeners to monitor status changes:
board.onStatusChange((status) => {
  if (status === BoardStatus.ERROR) {
    // Handle error state
  }
});
  1. Clean up resources when done:
const unsubscribe = board.onStatusChange(callback);
// Later...
unsubscribe();
  1. Handle errors appropriately:
try {
  await files.write('/main.py', code);
  await board.run();
} catch (error) {
  console.error('Operation failed:', error);
}

Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests to our GitHub repository.

License

MIT License - see the LICENSE file for details.