This module provides utilities for working with model paths in asset bundles, file systems, and Play Asset Delivery.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/XDcobra/react-native-sherpa-onnx/llms.txt
Use this file to discover all available pages before exploring further.
assetModelPath()
Create a model path configuration for models bundled in your app’s assets.Parameters
Path relative to assets directory (e.g.,
"models/sherpa-onnx-whisper-tiny").Returns
Model path configuration with type
'asset'.Example
fileModelPath()
Create a model path configuration for models in the file system.Parameters
Absolute path to model directory. On iOS, use an absolute path from
react-native-fs:Returns
Model path configuration with type
'file'.Example
autoModelPath()
Create a model path configuration with automatic path type detection.Parameters
Path to check (will be tried as both asset and file path).
Returns
Model path configuration with type
'auto'.Example
resolveModelPath()
Resolve a model path configuration to a platform-specific absolute path.Parameters
Model path configuration from
assetModelPath(), fileModelPath(), or autoModelPath().Returns
Absolute path usable by native code.
Example
listAssetModels()
List all model folders in the assets/models directory.Returns
Array of model information objects.
Example
listModelsAtPath()
List model folders under a specific filesystem path.Parameters
Absolute filesystem path to scan for models.
When true, returns relative folder paths under the base path recursively.
Returns
Array of model information objects (see listAssetModels()).
Example
getAssetPackPath()
Android Only: Get the path to models directory inside an Android asset pack delivered via Play Asset Delivery (PAD).Parameters
Name of the asset pack (e.g.,
"sherpa_models").Returns
Path to the models directory in the asset pack, or
null if the pack is not available.Platform Support
- Android: Full support with Play Asset Delivery
- iOS: Always returns
null
Example
getDefaultModelPath()
Get the default model directory path for the current platform.react-native-fs instead.
Returns
- iOS:
"Documents/models" - Android:
"models"
Example
Types
ModelPathConfig
Model path configuration discriminated union.'asset': Model is bundled in app assets'file': Model is in file system (absolute path)'auto': Automatically detect (tries asset first, then file)
Path to the model directory.
See Also
- STT Initialization - Using model paths with STT
- TTS Initialization - Using model paths with TTS
- Model Download Manager - Downloading models at runtime