createRandomAccessSource

Android implementation of createRandomAccessSource.

Returns null on Android as file access patterns differ. Callers should fall back to legacy GGUFReader which loads the full file.

Future: Could implement using Android-specific file APIs.

Platform-specific factory for creating RandomAccessSource instances.

Returns null on platforms that don't support random file access, allowing callers to fall back to legacy sequential loading.

Supported platforms:

  • JVM: Uses FileChannel for efficient random access

  • JS/Native: Returns null (use legacy GGUFReader instead)

Return

A RandomAccessSource, or null if not supported on this platform

Parameters

filePath

Path to the file

JS implementation of createRandomAccessSource.

Returns null as JavaScript doesn't have efficient random file access. Callers should fall back to legacy GGUFReader which loads the full file.

Future: Could implement using File System Access API for browsers that support it, or Node.js fs module for server-side.

JVM implementation of createRandomAccessSource.

Uses JvmRandomAccessSource backed by FileChannel for efficient random access to GGUF files.

Native implementation of createRandomAccessSource.

Returns null as native random file access is not yet implemented. Callers should fall back to legacy GGUFReader which loads the full file.

Future: Could implement using POSIX pread() for efficient random access.

WasmJS implementation of createRandomAccessSource.

Returns null as WasmJS doesn't have efficient random file access. Callers should fall back to legacy GGUFReader which loads the full file.

WasmWASI implementation of createRandomAccessSource.

Returns null as WasmWASI doesn't have efficient random file access. Callers should fall back to legacy GGUFReader which loads the full file.