Interface DeviceDriver<TData>

A device driver

interface DeviceDriver<TData> {
    isBuffered?: boolean;
    name: string;
    close?(file: DeviceFile): void;
    init?(ino: bigint): {
        data?: TData;
        major?: number;
        minor?: number;
    };
    read(file: DeviceFile, buffer: ArrayBufferView, offset?: number, length?: number, position?: number): number;
    sync?(file: DeviceFile): void;
    write(file: DeviceFile, buffer: Uint8Array, offset: number, length: number, position?: number): number;
}

Type Parameters

  • TData = any

Properties

Methods

File operations

Properties

isBuffered?: boolean

Whether the device is buffered (a "block" device) or unbuffered (a "character" device)

false
name: string

The name of the device driver

Methods

  • Experimental

    Initializes a new device.

    Parameters

    • ino: bigint

    Returns {
        data?: TData;
        major?: number;
        minor?: number;
    }

    Device.data

    • Optional Experimentaldata?: TData
    • Optional Experimentalmajor?: number
    • Optional Experimentalminor?: number

File operations

  • Synchronously read from the device

    Parameters

    • file: DeviceFile
    • buffer: ArrayBufferView
    • Optionaloffset: number
    • Optionallength: number
    • Optionalposition: number

    Returns number

  • Synchronously write to the device

    Parameters

    • file: DeviceFile
    • buffer: Uint8Array
    • offset: number
    • length: number
    • Optionalposition: number

    Returns number