createRandomAccessSource
Android implementation of createRandomAccessSource.
Returns null on Android as file access patterns differ. Callers should fall back to legacy (full file load) mode.
Future: Could implement using Android-specific file APIs.
Platform-specific factory for creating RandomAccessSource instances.
On JVM/Android, this uses efficient file channel-based random access. On other platforms (JS, Native), this returns null and the fallback non-streaming mode should be used.
Return
RandomAccessSource if platform supports it, null otherwise
Parameters
Path to the file
JS implementation of createRandomAccessSource.
Returns null as JavaScript doesn't support efficient random file access. Callers should fall back to legacy (full file load) mode.
JVM implementation of createRandomAccessSource.
Uses JvmRandomAccessSource backed by FileChannel for efficient random access to SafeTensors files.
Native implementation of createRandomAccessSource.
Returns null as native random access is not yet implemented. Callers should fall back to legacy (full file load) mode.
WASM/JS implementation of createRandomAccessSource.
Returns null as WASM doesn't support efficient random file access. Callers should fall back to legacy (full file load) mode.
WASM/WASI implementation of createRandomAccessSource.
Returns null as WASM WASI doesn't support efficient random file access. Callers should fall back to legacy (full file load) mode.