API reference
Preparing search index…

FileCallbacks

Synchronous file provider methods; omitted methods use Native byte storage.

Methods are captured once and keep their original this. Open may return a byte snapshot or an existing memory/custom stream. File streams cannot be returned because they already use this provider. File byte snapshots use stdio seek semantics; custom streams preserve their own seek semantics. Callbacks cannot reenter Native APIs or return Promises. Resource preload obtains custom bytes on the owning thread and decodes images on workers.

interface FileCallbacks {
    close(file: FileHandle): void;
    length(file: FileHandle): number;
    loadFile(path: string): null | Uint8Array;
    open(path: string): null | Uint8Array | Stream;
    read(output: Uint8Array, size: number, file: FileHandle): number;
    seek(file: FileHandle, offset: number, origin: SeekOrigin): boolean;
    tell(file: FileHandle): number;
}
Source & inheritance
Member directory7

Methods

Methods

  • Override whole-file loading; otherwise Native runs open/length/read/close.

    Parameters

    path
    string

    Resource path.

    Returns

    null | Uint8Array

    Snapshot bytes or null on failure.

    Source & inheritance
  • Open a source, returning null when it does not exist.

    Parameters

    path
    string

    Exact Native resource path.

    Returns

    null | Uint8Array | Stream

    Native-owned bytes, an existing stream, or null.

    Source & inheritance
  • Read into independent scratch bytes, returning an integer in [0, size].

    Parameters

    output
    Uint8Array

    Fixed scratch array; do not detach its buffer.

    size
    number

    Maximum requested bytes.

    file

    Open token.

    Returns

    number

    Exact bytes written.

    Source & inheritance

Icons made by Lorc, Delapouite & Skoll · game-icons.net · CC BY 3.0