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

react-native-rusto

v0.1.2

Published

React Native bindings for RustO! OCR library

Readme

React Native RustO

React Native bindings for the RustO! OCR library.

Installation

npm install react-native-rusto
# or
yarn add react-native-rusto

iOS Setup

cd ios && pod install

Make sure to place the RustO.xcframework in the ios/ directory.

Android Setup

The Android native library will be linked automatically. Ensure that:

  1. The main rusto-android package is available in your project
  2. Your project includes the native .so libraries in the correct architecture folders

Usage

Basic Usage (with bundled models)

import { initialize, detectText, getVersion } from 'react-native-rusto';

// Initialize with bundled default models (no parameters needed!)
await initialize();

// Detect text from image file
const results = await detectText('/path/to/image.jpg');

results.forEach((result) => {
  console.log(`Text: ${result.text}`);
  console.log(`Score: ${result.score}`);
  console.log(`Box: ${result.box_points}`);
});

// Get library version
const version = await getVersion();
console.log(`RustO version: ${version}`);

Advanced Usage (with custom models)

import { initialize, detectText } from 'react-native-rusto';

// Initialize with custom model files
await initialize(
  '/custom/path/det_model.mnn',    // Detection model
  '/custom/path/rec_model.mnn',    // Recognition model
  '/custom/path/dict.txt'          // Dictionary file
);

// Or partially override (use bundled models for unspecified parameters)
await initialize(undefined, undefined, '/custom/dict.txt');

Model Bundling

Model files can be bundled with your app. See BUNDLING.md for detailed instructions on how to:

  • Bundle models with Android AAR
  • Bundle models with iOS XCFramework
  • Reduce app size with on-demand loading

API

initialize(detModel?: string, recModel?: string, dict?: string): Promise<boolean>

Initialize the RustO engine with model files.

Parameters (all optional):

  • detModel: Path to detection model file (default: 'det.mnn' from bundled assets)
  • recModel: Path to recognition model file (default: 'rec.mnn' from bundled assets)
  • dict: Path to dictionary file (default: 'dict.txt' from bundled assets)

Model files are searched in this order:

  1. iOS: Resource bundle → Main bundle → Documents directory
  2. Android: Custom path → Assets (auto-extracted to cache)

Returns: true on successful initialization

Examples:

// Use bundled models (recommended)
await initialize();

// Use custom models
await initialize('/path/to/det.mnn', '/path/to/rec.mnn', '/path/to/dict.txt');

// Mix bundled and custom
await initialize(undefined, undefined, '/custom/dict.txt');

detectText(imagePath: string): Promise<TextResult[]>

Perform OCR on an image file.

Parameters:

  • imagePath: Absolute path to the image file

Returns: Array of TextResult objects

detectTextFromBytes(imageData: string): Promise<TextResult[]>

Perform OCR on base64-encoded image data.

Parameters:

  • imageData: Base64-encoded image data

Returns: Array of TextResult objects

getVersion(): Promise<string>

Get the RustO library version.

Returns: Version string

TextResult

interface TextResult {
  text: string;
  score: number;
  box_points: [[number, number], [number, number], [number, number], [number, number]];
}

Platform Support

  • ✅ iOS 13.0+
  • ✅ Android API 21+
  • Architectures:
    • iOS: arm64, x86_64 (simulator)
    • Android: armeabi-v7a, arm64-v8a, x86, x86_64

License

MIT