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

@nosmai/moderation-react-native

v0.1.0

Published

On-device content and text moderation for React Native (image NSFW, object detection, chat toxicity), powered by the native Nosmai SDK.

Downloads

185

Readme

@nosmai/moderation-react-native

On-device content and text moderation for React Native, wrapping the native Nosmai SDK (CoreML/ANE on iOS, NCNN/Vulkan on Android). Image NSFW, object detection (weapon / drug / cigarette / alcohol) and chat toxicity. Everything runs offline; no frame or message leaves the device.

Image, video, text moderation and a live-camera preview are all supported.

Requirements

  • iOS 15.1+, Android API 24+ (arm64-v8a only), New Architecture enabled.
  • Android host app on Kotlin 2.2.0+ (the native AAR ships Kotlin 2.2.0 metadata).
  • A Nosmai license key registered for your app's bundle id (iOS) / package name (Android) at https://nosmai.com/.

Install

npm install @nosmai/moderation-react-native

iOS

No extra step. The pod depends on NosmaiModerationSDK, so pod install pulls the native SDK and its encrypted models. Set the Podfile platform to 15.1 and, because the SDK is a static xcframework, keep ENABLE_USER_SCRIPT_SANDBOXING = NO (a Podfile post_install can force it). Add NSCameraUsageDescription and ITSAppUsesNonExemptEncryption = NO to Info.plist.

Android

The native SDK ships as a large AAR that the host app must provide (the plugin references it at compile time only):

  1. Download nosmai-detection.aar from the Android releases into android/app/libs/nosmai-detection.aar.
  2. In android/app/build.gradle:
    android { defaultConfig { minSdkVersion 24; ndk { abiFilters "arm64-v8a" } } }
    dependencies { implementation files("libs/nosmai-detection.aar") }
  3. Ensure the project uses Kotlin 2.2.0+.

Usage

import { NosmaiModeration } from '@nosmai/moderation-react-native';

// Initialize once. Load only the models you use.
const init = await NosmaiModeration.initialize('NOSMAI-XXXX', [
  'objectDetection',
  'nsfw',
]);
if (!init.success) {
  console.warn('Moderation unavailable:', init.error);
}

// Image (objects + NSFW).
const r = await NosmaiModeration.analyzeImage(filePath);
if (r.isUnsafe) {
  // r.detections, r.nsfw ('safe' | 'warn' | 'block')
}

// Recorded video.
const v = await NosmaiModeration.analyzeVideo(filePath, 500);

// Chat text (optional model).
await NosmaiModeration.initializeText();
const t = await NosmaiModeration.moderateText('a message to check');
if (t.blocked) {
  console.log('blocked:', t.category);
}

// Tune thresholds at runtime.
NosmaiModeration.setThreshold('weapon', 0.85);
NosmaiModeration.setNsfwThreshold('explicit', 0.45);

// Free native resources.
NosmaiModeration.shutdown();

Live camera

Render <NosmaiCameraPreview /> to open the camera and moderate every frame. The native view owns the camera lifecycle: it starts on mount and stops on unmount. Request camera permission before mounting it.

import { NosmaiCameraPreview } from '@nosmai/moderation-react-native';

<NosmaiCameraPreview
  style={{ width: '100%', height: 320 }}
  facing="back" // or "front"
  onResult={(r) => {
    if (r.isUnsafe) {
      // r.nsfw ('safe' | 'warn' | 'block'), r.detections
    }
  }}
/>

Add NSCameraUsageDescription (iOS) and the CAMERA permission (Android). The live path also requires a license with the live feature enabled.

All async methods run native inference off the JS thread. analyzeImage, analyzeVideo and moderateText return the typed result shapes exported from this package (NosmaiResult, NosmaiVideoResult, NosmaiTextResult).

How it works

The Turbo Module bridges to the native SDK: iOS calls the NosmaiModerationSDK pod, Android calls the AAR. Results cross the bridge as JSON and are parsed into typed objects with string enums, so the API matches the native and web SDKs. Models are encrypted and decrypted in native memory, keyed by the license.

License

Proprietary. Register your app at https://nosmai.com/ to get a license key.